
<div class="sidebar" style="
left: 0px;
position: fixed;
top: 0px;
padding-top:40px;
padding-left:20px;
bottom: 0;
overflow-y: scroll;
width: 15em;
z-index: 1;
">
<a href="cheat_sheet.html">light</a>  <a href="cheat_sheet_dark.html">dark</a>

<a style="color:hsl(50.0, 89%, 28%);" href="#Entity">Entity</a>
<a style="color:hsl(50.0, 89%, 28%);" href="#Text">Text</a>
<a style="color:hsl(50.0, 89%, 28%);" href="#Button">Button</a>
<a style="color:hsl(50.0, 89%, 28%);" href="#mouse">mouse</a>
<a style="color:hsl(50.0, 89%, 28%);" href="#raycaster">raycaster</a>

<a style="color:hsl(20.0, 89%, 28%);" href="#application">application</a>
<a style="color:hsl(20.0, 89%, 28%);" href="#build">build</a>
<a style="color:hsl(20.0, 89%, 28%);" href="#camera">camera</a>
<a style="color:hsl(20.0, 89%, 28%);" href="#color">color</a>
<a style="color:hsl(20.0, 89%, 28%);" href="#curve">curve</a>
<a style="color:hsl(20.0, 89%, 28%);" href="#duplicate">duplicate</a>
<a style="color:hsl(20.0, 89%, 28%);" href="#input_handler">input_handler</a>
<a style="color:hsl(20.0, 89%, 28%);" href="#main">main</a>
<a style="color:hsl(20.0, 89%, 28%);" href="#mesh_importer">mesh_importer</a>
<a style="color:hsl(20.0, 89%, 28%);" href="#scene">scene</a>
<a style="color:hsl(20.0, 89%, 28%);" href="#shader">shader</a>
<a style="color:hsl(20.0, 89%, 28%);" href="#string_utilities">string_utilities</a>
<a style="color:hsl(20.0, 89%, 28%);" href="#text">text</a>
<a style="color:hsl(20.0, 89%, 28%);" href="#texture_importer">texture_importer</a>
<a style="color:hsl(20.0, 89%, 28%);" href="#ursinamath">ursinamath</a>
<a style="color:hsl(20.0, 89%, 28%);" href="#ursinastuff">ursinastuff</a>
<a style="color:hsl(20.0, 89%, 28%);" href="#window">window</a>

<a style="color:hsl(349.0, 89%, 28%);" href="#Audio">Audio</a>
<a style="color:hsl(349.0, 89%, 28%);" href="#Collider">Collider</a>
<a style="color:hsl(349.0, 89%, 28%);" href="#BoxCollider">BoxCollider</a>
<a style="color:hsl(349.0, 89%, 28%);" href="#SphereCollider">SphereCollider</a>
<a style="color:hsl(349.0, 89%, 28%);" href="#MeshCollider">MeshCollider</a>
<a style="color:hsl(349.0, 89%, 28%);" href="#CollisionZone">CollisionZone</a>
<a style="color:hsl(349.0, 89%, 28%);" href="#Color">Color</a>
<a style="color:hsl(349.0, 89%, 28%);" href="#CubicBezier">CubicBezier</a>
<a style="color:hsl(349.0, 89%, 28%);" href="#HitInfo">HitInfo</a>
<a style="color:hsl(349.0, 89%, 28%);" href="#Keys">Keys</a>
<a style="color:hsl(349.0, 89%, 28%);" href="#Light">Light</a>
<a style="color:hsl(349.0, 89%, 28%);" href="#DirectionalLight">DirectionalLight</a>
<a style="color:hsl(349.0, 89%, 28%);" href="#PointLight">PointLight</a>
<a style="color:hsl(349.0, 89%, 28%);" href="#AmbientLight">AmbientLight</a>
<a style="color:hsl(349.0, 89%, 28%);" href="#SpotLight">SpotLight</a>
<a style="color:hsl(349.0, 89%, 28%);" href="#Ursina">Ursina</a>
<a style="color:hsl(349.0, 89%, 28%);" href="#MeshModes">MeshModes</a>
<a style="color:hsl(349.0, 89%, 28%);" href="#Mesh">Mesh</a>
<a style="color:hsl(349.0, 89%, 28%);" href="#Wait">Wait</a>
<a style="color:hsl(349.0, 89%, 28%);" href="#Func">Func</a>
<a style="color:hsl(349.0, 89%, 28%);" href="#Sequence">Sequence</a>
<a style="color:hsl(349.0, 89%, 28%);" href="#Shader">Shader</a>
<a style="color:hsl(349.0, 89%, 28%);" href="#Texture">Texture</a>
<a style="color:hsl(349.0, 89%, 28%);" href="#Trigger">Trigger</a>
<a style="color:hsl(349.0, 89%, 28%);" href="#Empty">Empty</a>
<a style="color:hsl(349.0, 89%, 28%);" href="#Vec2">Vec2</a>
<a style="color:hsl(349.0, 89%, 28%);" href="#Vec3">Vec3</a>

<a style="color:hsl(320.0, 89%, 28%);" href="#Animation">Animation</a>
<a style="color:hsl(320.0, 89%, 28%);" href="#Animator">Animator</a>
<a style="color:hsl(320.0, 89%, 28%);" href="#ButtonGroup">ButtonGroup</a>
<a style="color:hsl(320.0, 89%, 28%);" href="#ButtonList">ButtonList</a>
<a style="color:hsl(320.0, 89%, 28%);" href="#Cursor">Cursor</a>
<a style="color:hsl(320.0, 89%, 28%);" href="#DebugMenu">DebugMenu</a>
<a style="color:hsl(320.0, 89%, 28%);" href="#Draggable">Draggable</a>
<a style="color:hsl(320.0, 89%, 28%);" href="#DropdownMenuButton">DropdownMenuButton</a>
<a style="color:hsl(320.0, 89%, 28%);" href="#DropdownMenu">DropdownMenu</a>
<a style="color:hsl(320.0, 89%, 28%);" href="#EditorCamera">EditorCamera</a>
<a style="color:hsl(320.0, 89%, 28%);" href="#ExitButton">ExitButton</a>
<a style="color:hsl(320.0, 89%, 28%);" href="#FileButton">FileButton</a>
<a style="color:hsl(320.0, 89%, 28%);" href="#FileBrowser">FileBrowser</a>
<a style="color:hsl(320.0, 89%, 28%);" href="#FileBrowserSave">FileBrowserSave</a>
<a style="color:hsl(320.0, 89%, 28%);" href="#FirstPersonController">FirstPersonController</a>
<a style="color:hsl(320.0, 89%, 28%);" href="#FrameAnimation3d">FrameAnimation3d</a>
<a style="color:hsl(320.0, 89%, 28%);" href="#GridEditor">GridEditor</a>
<a style="color:hsl(320.0, 89%, 28%);" href="#PixelEditor">PixelEditor</a>
<a style="color:hsl(320.0, 89%, 28%);" href="#ASCIIEditor">ASCIIEditor</a>
<a style="color:hsl(320.0, 89%, 28%);" href="#HealthBar">HealthBar</a>
<a style="color:hsl(320.0, 89%, 28%);" href="#HotReloader">HotReloader</a>
<a style="color:hsl(320.0, 89%, 28%);" href="#ContentTypes">ContentTypes</a>
<a style="color:hsl(320.0, 89%, 28%);" href="#InputField">InputField</a>
<a style="color:hsl(320.0, 89%, 28%);" href="#MemoryCounter">MemoryCounter</a>
<a style="color:hsl(320.0, 89%, 28%);" href="#Panel">Panel</a>
<a style="color:hsl(320.0, 89%, 28%);" href="#PlatformerController2d">PlatformerController2d</a>
<a style="color:hsl(320.0, 89%, 28%);" href="#RadialMenu">RadialMenu</a>
<a style="color:hsl(320.0, 89%, 28%);" href="#RadialMenuButton">RadialMenuButton</a>
<a style="color:hsl(320.0, 89%, 28%);" href="#Sky">Sky</a>
<a style="color:hsl(320.0, 89%, 28%);" href="#Slider">Slider</a>
<a style="color:hsl(320.0, 89%, 28%);" href="#ThinSlider">ThinSlider</a>
<a style="color:hsl(320.0, 89%, 28%);" href="#Sprite">Sprite</a>
<a style="color:hsl(320.0, 89%, 28%);" href="#TextField">TextField</a>
<a style="color:hsl(320.0, 89%, 28%);" href="#Tooltip">Tooltip</a>
<a style="color:hsl(320.0, 89%, 28%);" href="#TrailRenderer">TrailRenderer</a>
<a style="color:hsl(320.0, 89%, 28%);" href="#VideoRecorder">VideoRecorder</a>
<a style="color:hsl(320.0, 89%, 28%);" href="#VideoRecorderUI">VideoRecorderUI</a>
<a style="color:hsl(320.0, 89%, 28%);" href="#Space">Space</a>
<a style="color:hsl(320.0, 89%, 28%);" href="#WindowPanel">WindowPanel</a>

<a style="color:hsl(290.0, 89%, 28%);" href="#chunk_mesh">chunk_mesh</a>
<a style="color:hsl(290.0, 89%, 28%);" href="#colorize">colorize</a>
<a style="color:hsl(290.0, 89%, 28%);" href="#combine">combine</a>
<a style="color:hsl(290.0, 89%, 28%);" href="#generate_normals">generate_normals</a>
<a style="color:hsl(290.0, 89%, 28%);" href="#grid_layout">grid_layout</a>
<a style="color:hsl(290.0, 89%, 28%);" href="#merge_vertices">merge_vertices</a>
<a style="color:hsl(290.0, 89%, 28%);" href="#NoclipMode">NoclipMode</a>
<a style="color:hsl(290.0, 89%, 28%);" href="#NoclipMode2d">NoclipMode2d</a>
<a style="color:hsl(290.0, 89%, 28%);" href="#PositionLimiter">PositionLimiter</a>
<a style="color:hsl(290.0, 89%, 28%);" href="#project_uvs">project_uvs</a>
<a style="color:hsl(290.0, 89%, 28%);" href="#Scrollable">Scrollable</a>
<a style="color:hsl(290.0, 89%, 28%);" href="#SmoothFollow">SmoothFollow</a>
<a style="color:hsl(290.0, 89%, 28%);" href="#terraincast">terraincast</a>

<a style="color:hsl(259.0, 89%, 28%);" href="#models">models</a>
<a style="color:hsl(259.0, 89%, 28%);" href="#textures">textures</a>
<a style="color:hsl(259.0, 89%, 28%);" href="#shaders">shaders</a>
<a style="color:hsl(259.0, 89%, 28%);" href="#Circle">Circle</a>
<a style="color:hsl(259.0, 89%, 28%);" href="#Cone">Cone</a>
<a style="color:hsl(259.0, 89%, 28%);" href="#Cylinder">Cylinder</a>
<a style="color:hsl(259.0, 89%, 28%);" href="#Grid">Grid</a>
<a style="color:hsl(259.0, 89%, 28%);" href="#Plane">Plane</a>
<a style="color:hsl(259.0, 89%, 28%);" href="#Prismatoid">Prismatoid</a>
<a style="color:hsl(259.0, 89%, 28%);" href="#Quad">Quad</a>
<a style="color:hsl(259.0, 89%, 28%);" href="#Terrain">Terrain</a>

</div>
        <style>
            html {
              scrollbar-face-color: hsl(0.0, 0%, 10%);
              scrollbar-base-color: hsl(0.0, 0%, 10%);
              scrollbar-3dlight-color: hsl(0.0, 0%, 10%)4;
              scrollbar-highlight-color: hsl(0.0, 0%, 10%);
              scrollbar-track-color: hsl(0.0, 0%, 99%);
              scrollbar-arrow-color: hsl(0.0, 0%, 99%);
              scrollbar-shadow-color: hsl(0.0, 0%, 10%);
              scrollbar-darkshadow-color: hsl(0.0, 0%, 10%);
            }

            ::-webkit-scrollbar { width: 8px; height: 3px;}
            ::-webkit-scrollbar { width: 8px; height: 3px;}
            ::-webkit-scrollbar-button {  background-color: hsl(0.0, 0%, 90%); }
            ::-webkit-scrollbar-track {  background-color: hsl(0.0, 0%, 99%);}
            ::-webkit-scrollbar-track-piece { background-color: hsl(0.0, 0%, 99%);}
            ::-webkit-scrollbar-thumb { height: 50px; background-color: hsl(0.0, 0%, 90%); border-radius: 3px;}
            ::-webkit-scrollbar-corner { background-color: hsl(0.0, 0%, 99%);}
            ::-webkit-resizer { background-color: hsl(0.0, 0%, 99%);}

            body {
                margin: auto;
                background-color: hsl(0.0, 0%, 99%);
                color: hsl(0.0, 0%, 10%);
                font-family: monospace;
                position: absolute;
                top:0;
                left: 24em;
                font-size: 1.375em;
                font-weight: lighter;
                max-width: 100%;
                overflow-x: hidden;
                white-space: pre-wrap;
            }
            a {
              color: hsl(0.0, 0%, 50%);
            }

            purple {color: hsl(289.0, 50%, 50%);}
            gray {color: gray;}
            olive {color: olive;}
            yellow {color: darkgoldenrod;}
            green {color: seagreen;}
            blue {color: hsl(210, 50%, 50%);}

            .example {
                padding-left: 1em;
                background-color: hsl(0.0, 0%, 90%);
            }
            .params {
                color:hsl(0.0, 0%, 0%);
                font-weight:bold;
            }
        </style>
        <div id="content"><title> ursina cheat sheet</title>
        <b>Ursina cheat sheet</b>

        This document lists most modules and classes in ursina. Each section is structured as follows:

        ClassName(BaseClass)
            module location

            parameters
                How instantiate the class, ie. Button(text='', **kwargs).
                '**kwargs' in this case, means you can give it optional keyword arguments.
                For example, Button('Start', scale=.25, color=color.blue, position=(-.1,.25)) also incldues
                information on how big the button should be, its color and its position.

            attributes
                Names of values we can get/set, sometimes followed by its starting value and a short explanation.
                For example, 'scale', 'color' and 'position' are
                attributes we gave the Button above. These are members of Entity, which Button class
                inherits from, so the Button class can also access these.

            methods/functions
                these ends with (), which means they are functions that can be called.
                Also lists their parameters and default arguments.
                For example, Entity has a method called 'look_at()'. You need to give it a
                'target' (an Entity or position) to look at and optionally say
                which axis will be facing the target.

            example

        You can search the document with Ctrl+F for instant search results.
    
<div id="Entity"><div id="Entity" style="color:hsl(50.0, 89%, 28%); font-size:1.75em; font-weight:normal;">Entity<gray>()</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/entity.py"><gray>ursina.entity</gray></a><br><br><params class="params">Entity(add_to_scene_entities=True, **kwargs)</params>

name<gray> = camel_to_snake(self.type)</gray> 
enabled<gray> = True     # disabled entities wil not be visible nor run code.</gray> 
visible<gray> = True</gray> 
ignore<gray> = False     # if True, will not try to run code.</gray> 
eternal<gray> = False    # eternal entities does not get destroyed on scene.clear()</gray> 
ignore_paused<gray> = False      # if True, will still run when application is paused. useful when making a pause menu for example.</gray> 
ignore_input<gray> = False</gray> 
parent<gray> = scene     # default parent is scene, which means it's in 3d space. to use UI space, set the parent to camera.ui instead.</gray> 
add_to_scene_entities<gray> = add_to_scene_entities # set to False to be ignored by the engine, but still get rendered.</gray> 
model<gray> = None       # set model with model='model_name' (without file type extention)</gray> 
color<gray> = color.white</gray> 
texture<gray> = None     # set model with texture='texture_name'. requires a model to be set beforehand.</gray> 
render_queue<gray> = 0</gray> 
double_sided<gray> = False</gray> 
collision<gray> = False  # toggle collision without changing collider.</gray> 
collider<gray> = None    # set to 'box'/'sphere'/'mesh' for auto fitted collider.</gray> 
scripts<gray> = list()   # add with add_script(class_instance). will assign an 'entity' variable to the script.</gray> 
animations<gray> = list()</gray> 
hovered<gray> = False    # will return True if mouse hovers entity.</gray> 
origin<gray> = Vec3(0,0,0)</gray> 
position<gray> = Vec3(0,0,0) # right, up, forward. can also set self.x, self.y, self.z</gray> 
rotation<gray> = Vec3(0,0,0) # can also set self.rotation_x, self.rotation_y, self.rotation_z</gray> 
scale<gray> = Vec3(1,1,1)    # can also set self.scale_x, self.scale_y, self.scale_z</gray> 
line_definition<gray> = None # returns a Traceback(filename, lineno, function, code_context, index).</gray> 
world_parent
type                <gray># get class name.</gray>
types               <gray># get all class names including those this inhertits from.</gray>
visible_self        <gray># set visibility of self, without affecting children.</gray>
origin_x
origin_y
origin_z
world_position
world_x
world_y
world_z
x
y
z
X                   <gray># shortcut for int(entity.x)</gray>
Y                   <gray># shortcut for int(entity.y)</gray>
Z                   <gray># shortcut for int(entity.z)</gray>
world_rotation
world_rotation_x
world_rotation_y
world_rotation_z
rotation_x
rotation_y
rotation_z
world_scale
world_scale_x
world_scale_y
world_scale_z
scale_x
scale_y
scale_z
transform           <gray># get/set position, rotation and scale</gray>
world_transform     <gray># get/set world_position, world_rotation and world_scale</gray>
forward             <gray># get forward direction.</gray>
back                <gray># get backwards direction.</gray>
right               <gray># get right direction.</gray>
left                <gray># get left direction.</gray>
up                  <gray># get up direction.</gray>
down                <gray># get down direction.</gray>
screen_position     <gray># get screen position(ui space) from world space.</gray>
shader
texture_scale
texture_offset
alpha
always_on_top
billboard           <gray># set to True to make this Entity always face the camera.</gray>
model_bounds
bounds
children
attributes          <gray># attribute names. used by duplicate() for instance.</gray>

enable()   
disable()   
set_shader_input(<gray>name, value</gray>)   
generate_sphere_map(<gray>size=512, name=f'sphere_map_{len(scene.entities)}'</gray>)   
generate_cube_map(<gray>size=512, name=f'cube_map_{len(scene.entities)}'</gray>)   
reparent_to(<gray>entity</gray>)   
get_position(<gray>relative_to=scene</gray>)   
set_position(<gray>value, relative_to=scene</gray>)   
add_script(<gray>class_instance</gray>)   
combine(<gray>analyze=False, auto_destroy=True, ignore=[]</gray>)   
flip_faces()   
look_at(<gray>target, axis='forward'</gray>)   
look_at_2d(<gray>target, axis='z'</gray>)   
has_ancestor(<gray>possible_ancestor</gray>)   
animate(<gray>name, value, duration=.1, delay=0, curve=curve.in_expo, loop=False, resolution=None, interrupt='kill', time_step=None, auto_destroy=True</gray>)   
animate_position(<gray>value, duration=.1, **kwargs</gray>)   
animate_rotation(<gray>value, duration=.1,  **kwargs</gray>)   
animate_scale(<gray>value, duration=.1, **kwargs</gray>)   
animate_{e}(<gray>value, duration=.1, delay=0, **kwargs</gray>)   
shake(<gray>duration=.2, magnitude=1, speed=.05, direction=(1,1)</gray>)   
animate_color(<gray>value, duration=.1, interrupt='finish', **kwargs</gray>)   
fade_out(<gray>value=0, duration=.5, **kwargs</gray>)   
fade_in(<gray>value=1, duration=.5, **kwargs</gray>)   
blink(<gray>value=color.clear, duration=.1, delay=0, curve=curve.in_expo_boomerang, interrupt='finish', **kwargs</gray>)   
intersects(<gray>traverse_target=scene, ignore=(), debug=False</gray>)   

<div class="example">e = <olive>Entity</olive>(<olive>model</olive>=<green>'quad'</green>, <olive>color</olive>=color.orange, <olive>position</olive>=(<yellow>0</yellow>,<yellow>0</yellow>,<yellow>1</yellow>), <olive>scale</olive>=<yellow>1</yellow>.<yellow>5</yellow>, <olive>rotation</olive>=(<yellow>0</yellow>,<yellow>0</yellow>,<yellow>4</yellow><yellow>5</yellow>), <olive>texture</olive>=<green>'brick'</green>)

<green><green><green>''</green></green>'example of inheriting Entity<green><green>''</green></green>'</green>
class Player(<olive>Entity</olive>):
    <purple>def</purple> __init__(self, **kwargs):
        super().__init__()
        self.<olive>model</olive>=<green>'cube'</green>
        self.color = color.red
        self.scale_y = <yellow>2</yellow>

        <purple>for</purple> key, value in kwargs.items():
            <blue>setattr</blue>(self, key, value)

    <purple>def</purple> input(self, key):
        <purple>if</purple> key == <green>'space'</green>:
            self.animate_x(<yellow>2</yellow>, duration=<yellow>1</yellow>)

    <purple>def</purple> update(self):
        self.x += held_keys[<green>'d'</green>] * time.dt * <yellow>1</yellow><yellow>0</yellow>
        self.x -= held_keys[<green>'a'</green>] * time.dt * <yellow>1</yellow><yellow>0</yellow>

player = Player(x=-<yellow>1</yellow>)
</div>
</div></div>
<div id="Text"><div id="Text" style="color:hsl(50.0, 89%, 28%); font-size:1.75em; font-weight:normal;">Text<gray>(<a style="color: gray;" href="#Entity">Entity</a>)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/text.py"><gray>ursina.text</gray></a><br><br><params class="params">Text(text='', start_tag=start_tag, end_tag=end_tag, ignore=True, **kwargs)</params>

size<gray> = Text.size</gray> 
parent<gray> = camera.ui</gray> 
text_nodes<gray> = list()</gray> 
images<gray> = list()</gray> 
origin<gray> = (-.5, .5)</gray> 
font<gray> = Text.default_font</gray> 
resolution<gray> = Text.default_resolution</gray> 
line_height<gray> = 1</gray> 
use_tags<gray> = True</gray> 
start_tag<gray> = start_tag</gray> 
end_tag<gray> = end_tag</gray> 
text_colors<gray> = {'default' : color.text_color}</gray> 
tag<gray> = Text.start_tag+'default'+Text.end_tag</gray> 
current_color<gray> = self.text_colors['default']</gray> 
scale_override<gray> = 1</gray> 
appear_sequence<gray> = None # gets created when calling appear()</gray> 
text                <gray># set this to update the text.</gray>
color               <gray># sets the default color.</gray>
width               <gray># gets the width of the widest line.</gray>
height              <gray># gets the height of the text</gray>
lines
wordwrap            <gray># set this to make the text wrap after a certain number of characters.</gray>
background

create_text_section(<gray>text, tag='', x=0, y=0</gray>)   
align()   
create_background(<gray>padding=size*2, radius=size, color=ursina.color.black66</gray>)   
appear(<gray>speed=.025, delay=0</gray>)   
get_width(<gray>string, font=None</gray>)   

<div class="example"><purple>from</purple> ursina <purple>import</purple> *
  app = Ursina()
  descr = dedent(<green><green>''</green>'
      &ltscale:1.5&gt&ltorange&gtRainstorm&ltdefault&gt&ltscale:1&gt
      Summon a &ltazure&gtrain storm &ltdefault&gtto deal 5 &ltazure&gtwater

      damage &ltdefault&gtto &lthsb(0,1,.7)&gteveryone, &ltdefault&gt&ltimage:file_icon&gt &ltred&gt&ltimage:file_icon&gt test &ltdefault&gtincluding &ltorange&gtyourself. &ltdefault&gt
      Lasts for 4 rounds.<green>''</green>'</green>).strip()

  Text.default_resolution = <yellow>1</yellow><yellow>0</yellow><yellow>8</yellow><yellow>0</yellow> * Text.size
  test = <purple><b>Text</b></purple>(<olive>origin</olive>=(.<yellow>5</yellow>,.<yellow>5</yellow>), <olive>text</olive>=descr)


  text = <purple><b>Text</b></purple>(<olive>text</olive>=descr, wordwrap=<yellow>1</yellow><yellow>0</yellow>, <olive>origin</olive>=(-.<yellow>5</yellow>,.<yellow>5</yellow>), <olive>y</olive>=.<yellow>2</yellow><yellow>5</yellow>, background=True)
  <olive>Entity</olive>(<olive>parent</olive>=camera.ui, <olive>model</olive>=<green>'circle'</green>, <olive>scale</olive>=.<yellow>0</yellow><yellow>5</yellow>, <olive>color</olive>=color.yellow, <olive>y</olive>=text.y, <olive>z</olive>=-<yellow>1</yellow>)


  <purple>def</purple> input(key):
      <purple>if</purple> key == <green>'a'</green>:
          test.appear(speed=.<yellow>0</yellow><yellow>2</yellow><yellow>5</yellow>)

  test.create_background()

  <blue>print</blue>(<green>'....'</green>, Text.get_width(<green>'yolo'</green>))
  app.run()
</div>
</div></div>
<div id="Button"><div id="Button" style="color:hsl(50.0, 89%, 28%); font-size:1.75em; font-weight:normal;">Button<gray>(<a style="color: gray;" href="#Entity">Entity</a>)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/prefabs/button.py"><gray>ursina.prefabs.button</gray></a><br><br><params class="params">Button(text='', **kwargs)</params>

parent<gray> = camera.ui</gray> 
collider<gray> = 'box'</gray> 
disabled<gray> = False</gray> 
color<gray> = Button.color</gray> 
text_entity<gray> = None</gray> 
highlight_color<gray> = self.color.tint(.2)</gray> 
pressed_color<gray> = self.color.tint(-.2)</gray> 
highlight_scale<gray> = 1    # multiplier</gray> 
pressed_scale<gray> = 1     # multiplier</gray> 
original_scale<gray> = self.scale</gray> 
icon<gray> = None</gray> 
text
text_origin
text_color

input(<gray>key</gray>)   
on_mouse_enter()   
on_mouse_exit()   
on_click()   
fit_to_text(<gray>radius=.1</gray>)   

<div class="example">b = <purple><b>Button</b></purple>(<olive>text</olive>=<green>'hello world!'</green>, <olive>color</olive>=color.azure, <olive>icon</olive>=<green>'sword'</green>, <olive>scale</olive>=.<yellow>2</yellow><yellow>5</yellow>, text_<olive>origin</olive>=(-.<yellow>5</yellow>,<yellow>0</yellow>))
b.on_click = application.quit <gray># assign a function to the button.</gray>
b.tooltip = Tooltip(<green>'exit'</green>)
</div>
</div></div>
<div id="mouse"><div id="mouse" style="color:hsl(50.0, 89%, 28%); font-size:1.75em; font-weight:normal;">mouse</div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/mouse.py"><gray>ursina.mouse</gray></a><br><br>enabled<gray> = False</gray> 
visible<gray> = True</gray> 
locked<gray> = False</gray> 
position<gray> = Vec3(0,0,0)</gray> 
delta<gray> = Vec3(0,0,0)</gray> 
prev_x<gray> = 0</gray> 
prev_y<gray> = 0</gray> 
start_x<gray> = 0</gray> 
start_y<gray> = 0</gray> 
velocity<gray> = Vec3(0,0,0)</gray> 
prev_click_time<gray> = time.time()</gray> 
prev_click_pos<gray> = None</gray> 
double_click_distance<gray> = .5</gray> 
double_click_movement_limit<gray> = .01</gray> 
hovered_entity<gray> = None # returns the closest hovered entity with a collider.</gray> 
left<gray> = False</gray> 
right<gray> = False</gray> 
middle<gray> = False</gray> 
delta_drag<gray> = Vec3(0,0,0)</gray> 
update_step<gray> = 1</gray> 
traverse_target<gray> = scene</gray> 
raycast<gray> = True</gray> 
collision<gray> = None</gray> 
collisions<gray> = list()</gray> 
enabled<gray> = True</gray> 
x
y
normal              <gray># returns the normal of the polygon, in local space.</gray>
world_normal        <gray># returns the normal of the polygon, in world space.</gray>
point               <gray># returns the point hit, in local space</gray>
world_point         <gray># returns the point hit, in world space</gray>

input(<gray>key</gray>)   
update()   
find_collision()   
unhover_everything_not_hit()   

<div class="example">Button(<olive>parent</olive>=scene, <olive>text</olive>=<green>'a'</green>)

<purple>def</purple> update():
    <blue>print</blue>(mouse.position, mouse.point)

Cursor()
mouse.visible = False
</div>
</div></div>
<div id="raycaster"><div id="raycaster" style="color:hsl(50.0, 89%, 28%); font-size:1.75em; font-weight:normal;">raycaster</div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/raycaster.py"><gray>ursina.raycaster</gray></a><br><br>
distance(<gray>a, b</gray>)   
raycast(<gray>origin, direction=(0,0,1), distance=inf, traverse_target=scene, ignore=list(), debug=False</gray>)   
boxcast(<gray>origin, direction=(0,0,1), distance=9999, thickness=(1,1), traverse_target=scene, ignore=list(), debug=False</gray>)   <gray># similar to raycast, but with width and height</gray>

<div class="example"><green><green>''</green>'
Casts a ray from *origin*, in *direction*, with length *distance* and returns
a HitInfo containing information about what it hit. This ray will only hit entities with a collider.

Use optional *traverse_target* to only be able to hit a specific entity and its children/descendants.
Use optional *ignore* list to ignore certain entities.
Setting debug to True will draw the line on screen.

Example where we only move if a wall is not hit:
<green>''</green>'</green>


class Player(<olive>Entity</olive>):

    <purple>def</purple> update(self):
        self.direction = Vec3(
            self.forward * (held_keys[<green>'w'</green>] - held_keys[<green>'s'</green>])
            + self.right * (held_keys[<green>'d'</green>] - held_keys[<green>'a'</green>])
            ).normalized()  <gray># get the direction we're trying to walk in.</gray>

        origin = self.world_position + (self.up*.5) <gray># the ray should start slightly up from the ground so we can walk up slopes or walk over small objects.</gray>
        hit_info = raycast(origin , self.direction, <olive>ignore</olive>=(self,), distance=.<yellow>5</yellow>, debug=False)
        <purple>if</purple> <purple>not</purple> hit_info.hit:
            self.position += self.direction * <yellow>5</yellow> * time.dt

Player(<olive>model</olive>=<green>'cube'</green>, origin_<olive>y</olive>=-.<yellow>5</yellow>, <olive>color</olive>=color.orange)
wall_left = <olive>Entity</olive>(<olive>model</olive>=<green>'cube'</green>, <olive>collider</olive>=<green>'box'</green>, scale_<olive>y</olive>=<yellow>3</yellow>, origin_<olive>y</olive>=-.<yellow>5</yellow>, <olive>color</olive>=color.azure, x=-<yellow>4</yellow>)
wall_right = duplicate(wall_left, x=<yellow>4</yellow>)
camera.y = <yellow>2</yellow>
</div>
</div></div>
<div id="application"><div id="application" style="color:hsl(20.0, 89%, 28%); font-size:1.75em; font-weight:normal;">application</div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/application.py"><gray>ursina.application</gray></a><br><br>paused<gray> = False</gray> 
time_scale<gray> = 1</gray> 
sequences<gray> = list()</gray> 
trace_entity_definition<gray> = False # enable to set entity.line_definition</gray> 
package_folder<gray> = Path(__file__).parent</gray> 
blender_paths<gray> = dict()</gray> 
development_mode<gray> = True</gray> 
scenes_folder<gray> = asset_folder / 'scenes/'</gray> 
scripts_folder<gray> = asset_folder / 'scripts/'</gray> 
fonts_folder<gray> = asset_folder / 'fonts/'</gray> 
compressed_textures_folder<gray> = asset_folder / 'textures_compressed/'</gray> 
compressed_models_folder<gray> = asset_folder / 'models_compressed/'</gray> 
base<gray> = None             # this will be set once the Ursina() is created</gray> 
hot_reloader<gray> = None     # will be set my main if development_mode</gray> 

pause()   
resume()   
quit()   
load_settings(<gray>path=asset_folder / 'settings.py'</gray>)   

</div></div>
<div id="build"><div id="build" style="color:hsl(20.0, 89%, 28%); font-size:1.75em; font-weight:normal;">build</div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/__init__.py"><gray>ursina.__init__</gray></a><br><br><params class="params">python -m ursina.build</params>



<div class="example">open cmd at your project folder and run 'python -m ursina.build' to package your app for windows.
</div>
</div></div>
<div id="camera"><div id="camera" style="color:hsl(20.0, 89%, 28%); font-size:1.75em; font-weight:normal;">camera</div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/camera.py"><gray>ursina.camera</gray></a><br><br>parent<gray> = scene</gray> 
name<gray> = 'camera'</gray> 
eternal<gray> = True</gray> 
ui_size<gray> = 40</gray> 
ui<gray> = None</gray> 
fov<gray> = 40</gray> 
orthographic<gray> = False</gray> 
clip_plane_near
clip_plane_far
aspect_ratio
shader

set_up()   
set_shader_input(<gray>name, value</gray>)   

<div class="example">window.borderless = False

camera.orthographic = True

e = <olive>Entity</olive>()
e.model = <green>'quad'</green>
e.color = color.random_color()
e.position = (-<yellow>2</yellow>, <yellow>0</yellow>, <yellow>1</yellow><yellow>0</yellow>)

e = <olive>Entity</olive>()
e.model = <green>'quad'</green>
e.color = color.random_color()
e.position = (<yellow>2</yellow>, <yellow>0</yellow>, <yellow>1</yellow><yellow>0</yellow>)

e = <olive>Entity</olive>()
e.model = <green>'quad'</green>
e.color = color.random_color()
e.position = (<yellow>0</yellow>, <yellow>0</yellow>, <yellow>4</yellow><yellow>0</yellow>)

Editor<purple><b>Camera</b></purple>()
<purple>from</purple> ursina.shaders <purple>import</purple> camera_grayscale_shader
camera.shader = camera_grayscale_shader
</div>
</div></div>
<div id="color"><div id="color" style="color:hsl(20.0, 89%, 28%); font-size:1.75em; font-weight:normal;">color</div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/color.py"><gray>ursina.color</gray></a><br><br>color<gray> = hsv</gray> 
white<gray> =         color(0, 0, 1)</gray> 
smoke<gray> =         color(0, 0, 0.96)</gray> 
light_gray<gray> =    color(0, 0, 0.75)</gray> 
gray<gray> =          color(0, 0, 0.5)</gray> 
dark_gray<gray> =     color(0, 0, 0.25)</gray> 
black<gray> =         color(0, 0, 0)</gray> 
red<gray> =           color(0, 1, 1)</gray> 
yellow<gray> =        color(60, 1, 1)</gray> 
lime<gray> =          color(90, 1, 1)</gray> 
green<gray> =         color(120, 1, 1)</gray> 
turquoise<gray> =     color(150, 1, 1)</gray> 
cyan<gray> =          color(180, 1, 1)</gray> 
azure<gray> =         color(210, 1, 1)</gray> 
blue<gray> =          color(240, 1, 1)</gray> 
violet<gray> =        color(270, 1, 1)</gray> 
magenta<gray> =       color(300, 1, 1)</gray> 
pink<gray> =          color(330, 1, 1)</gray> 
brown<gray> =         rgb(165, 42, 42)</gray> 
olive<gray> =         rgb(128, 128, 0)</gray> 
peach<gray> =         rgb(255, 218, 185)</gray> 
gold<gray> =          rgb(255, 215, 0)</gray> 
salmon<gray> =        rgb(250, 128, 114)</gray> 
clear<gray> =         Color(0, 0, 0, 0)</gray> 
white10<gray> =       Color(1,1,1, 0.10)</gray> 
white33<gray> =       Color(1,1,1, 0.33)</gray> 
white50<gray> =       Color(1,1,1, 0.50)</gray> 
white66<gray> =       Color(1,1,1, 0.66)</gray> 
black10<gray> =       Color(0,0,0, 0.10)</gray> 
black33<gray> =       Color(0,0,0, 0.33)</gray> 
black50<gray> =       Color(0,0,0, 0.50)</gray> 
black66<gray> =       Color(0,0,0, 0.66)</gray> 
text<gray> = smoke</gray> 
light_text<gray> = smoke</gray> 
dark_text<gray> = color(0, 0, .1)</gray> 
text_color<gray> = light_text</gray> 
color_names<gray> = ('white', 'smoke', 'light_gray', 'gray', 'dark_gray', 'black',</gray> 
colors<gray> = dict()</gray> 

hsv(<gray>h, s, v, a=1</gray>)   
rgba(<gray>r, g, b, a=255</gray>)   
rgb(<gray>r, g, b, a=255</gray>)   
to_hsv(<gray>color</gray>)   
hex(<gray>value</gray>)   
brightness(<gray>color</gray>)   
inverse(<gray>color</gray>)   
random_color()   
tint(<gray>color, amount=.2</gray>)   

<div class="example"><blue>print</blue>(color.brightness(color.blue))
<blue>print</blue>(_<yellow>3</yellow>)

p = <olive>Entity</olive>(x=-<yellow>2</yellow>)
<purple>for</purple> key in color.colors:
    <blue>print</blue>(key)
    b = Button(<olive>parent</olive>=p, <olive>model</olive>=Quad(subdivisions=<yellow>2</yellow>), <olive>color</olive>=color.colors[key], <olive>text</olive>=key)
    b.text_entity.scale *= .<yellow>5</yellow>

grid_layout(p.children, max_x=<yellow>8</yellow>)

<purple>for</purple> name in (<green>'r'</green>, <green>'g'</green>, <green>'b'</green>, <green>'h'</green>, <green>'s'</green>, <green>'v'</green>, <green>'brightness'</green>):
    <blue>print</blue>(name + <green>':'</green>, <blue>getattr</blue>(color.random_<purple><b>color</b></purple>(), name))

e = <olive>Entity</olive>(<olive>model</olive>=<green>'cube'</green>, <olive>color</olive>=color.lime)
<blue>print</blue>(e.color.name)
</div>
</div></div>
<div id="curve"><div id="curve" style="color:hsl(20.0, 89%, 28%); font-size:1.75em; font-weight:normal;">curve</div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/curve.py"><gray>ursina.curve</gray></a><br><br>
linear(<gray>t</gray>)   
in_sine(<gray>t</gray>)   
out_sine(<gray>t</gray>)   
in_out_sine(<gray>t</gray>)   
in_quad(<gray>t</gray>)   
out_quad(<gray>t</gray>)   
in_out_quad(<gray>t</gray>)   
in_cubic(<gray>t</gray>)   
out_cubic(<gray>t</gray>)   
in_out_cubic(<gray>t</gray>)   
in_quart(<gray>t</gray>)   
out_quart(<gray>t</gray>)   
in_out_quart(<gray>t</gray>)   
in_quint(<gray>t</gray>)   
out_quint(<gray>t</gray>)   
in_out_quint(<gray>t</gray>)   
in_expo(<gray>t</gray>)   
out_expo(<gray>t</gray>)   
in_out_expo(<gray>t</gray>)   
in_circ(<gray>t</gray>)   
out_circ(<gray>t</gray>)   
in_out_circ(<gray>t</gray>)   
in_back(<gray>t, magnitude=1.70158</gray>)   
out_back(<gray>t, magnitude=1.70158</gray>)   
in_out_back(<gray>t, magnitude=1.70158</gray>)   
in_elastic(<gray>t, magnitude=.7</gray>)   
out_elastic(<gray>t, magnitude=.7</gray>)   
in_out_elastic(<gray>t, magnitude=0.65</gray>)   
out_bounce(<gray>t</gray>)   
in_bounce(<gray>t</gray>)   
in_out_bounce(<gray>t</gray>)   
{e}_boomerang(<gray>t</gray>)   

<div class="example"><green><green><green>''</green></green>'Draws a sheet with every curve and its name<green><green>''</green></green>'</green>

camera.orthographic = True
camera.fov = <yellow>1</yellow><yellow>6</yellow>
camera.position = (<yellow>9</yellow>, <yellow>6</yellow>)
window.color = color.black

i = <yellow>0</yellow>
<purple>for</purple> e in dir(curve):
    try:
        item = <blue>getattr</blue>(curve, e)
        <blue>print</blue>(item.__name__, <green>':'</green>, item(.<yellow>7</yellow><yellow>5</yellow>))
        curve_renderer = <olive>Entity</olive>(
            <olive>model</olive>=Mesh(<olive>vertices</olive>=[Vec3(i / <yellow>3</yellow><yellow>1</yellow>, item(i / <yellow>3</yellow><yellow>1</yellow>), <yellow>0</yellow>) <purple>for</purple> i in <blue>range</blue>(<yellow>3</yellow><yellow>2</yellow>)], <olive>mode</olive>=<green>'line'</green>, <olive>thickness</olive>=<yellow>2</yellow>),
            <olive>color</olive>=color.light_gray)
        row = floor(i / <yellow>8</yellow>)
        curve_renderer.x = (i % <yellow>8</yellow>) * <yellow>2</yellow>.<yellow>5</yellow>
        curve_renderer.y = row * <yellow>1</yellow>.<yellow>7</yellow><yellow>5</yellow>
        label = Text(<olive>parent</olive>=curve_renderer, <olive>text</olive>=item.__name__, <olive>scale</olive>=<yellow>8</yellow>, <olive>color</olive>=color.gray, <olive>y</olive>=-.<yellow>1</yellow>)
        i += <yellow>1</yellow>
    except:
        pass

c = CubicBezier(<yellow>0</yellow>, .<yellow>5</yellow>, <yellow>1</yellow>, .<yellow>5</yellow>)
<blue>print</blue>(<green>'-----------'</green>, c.calculate(.<yellow>2</yellow><yellow>3</yellow>))

window.exit_button.visible = False
window.fps_counter.enabled = False
<green><green>''</green>'
These are used by Entity when animating, like this:

e = Entity()
e.animate_y(1, curve=curve.in_expo)

e2 = Entity(x=1.5)
e2.animate_y(1, curve=curve.CubicBezier(0,.7,1,.3))
<green>''</green>'</green>
</div>
</div></div>
<div id="duplicate"><div id="duplicate" style="color:hsl(20.0, 89%, 28%); font-size:1.75em; font-weight:normal;">duplicate</div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/duplicate.py"><gray>ursina.duplicate</gray></a><br><br>
duplicate(<gray>entity, copy_children=True, **kwargs): # use a for loop instead of duplicate(</gray>)   <gray># use a for loop instead of duplicate() if you can.</gray>

<div class="example">e = Button(<olive>parent</olive>=scene, <olive>scale</olive>=<yellow>1</yellow>, <olive>text</olive>=<green>'yolo'</green>)
e<yellow>2</yellow> = <purple><b>duplicate</b></purple>(e, x=<yellow>1</yellow>.<yellow>2</yellow><yellow>5</yellow>)
EditorCamera()
</div>
</div></div>
<div id="input_handler"><div id="input_handler" style="color:hsl(20.0, 89%, 28%); font-size:1.75em; font-weight:normal;">input_handler</div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/input_handler.py"><gray>ursina.input_handler</gray></a><br><br>held_keys<gray> = defaultdict(lambda: 0)</gray> 
rebinds<gray> = dict()</gray> 

bind(<gray>original_key, alternative_key</gray>)   
unbind(<gray>key</gray>)   
rebind(<gray>to_key, from_key</gray>)   
input(<gray>key</gray>)   

<div class="example">input_handler.bind(<green><green>'s'</green></green>, <green><green>'arrow down'</green></green>)  <gray># <green><green>'s'</green></green>-key will now be registered as <green><green>'arrow down'</green></green>-key</gray>

<purple>def</purple> test():
    <blue>print</blue>(<green>'----'</green>)
<purple>def</purple> input(key):
    <blue>print</blue>(key)
    <purple>if</purple> key == <green>'left mouse down'</green>:
        <blue>print</blue>(<green>'pressed left mouse button'</green>)

    if key == Keys.left_mouse_down:   <gray># same as above, but with Keys enum.</gray>
        <blue>print</blue>(<green>'pressed left mouse button'</green>)


<purple>def</purple> update():
    <purple>for</purple> key, value in held_keys.items():
        <purple>if</purple> value != <yellow>0</yellow>:
            <blue>print</blue>(key, value)
</div>
</div></div>
<div id="main"><div id="main" style="color:hsl(20.0, 89%, 28%); font-size:1.75em; font-weight:normal;">main</div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/main.py"><gray>ursina.main</gray></a><br><br>time.dt<gray> = 0</gray> 


<div class="example">app = Ursina()
app.run()
</div>
</div></div>
<div id="mesh_importer"><div id="mesh_importer" style="color:hsl(20.0, 89%, 28%); font-size:1.75em; font-weight:normal;">mesh_importer</div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/mesh_importer.py"><gray>ursina.mesh_importer</gray></a><br><br>blender_scenes<gray> = dict()</gray> 

load_model(<gray>name, path=application.asset_folder, file_types=('.bam', '.ursinamesh', '.obj', '.blend')</gray>)   
load_blender_scene(<gray>name, path=application.asset_folder, load=True, reload=False, skip_hidden=True, models_only=False</gray>)   
get_blender(<gray>blend_file</gray>)   <gray># try to get a matching blender version in case we have multiple blender version installed</gray>
compress_models(<gray>path=None, outpath=application.compressed_models_folder, name='*'</gray>)   
obj_to_ursinamesh()   
compress_models_fast(<gray>model_name=None, write_to_disk=False</gray>)   
ursina_mesh_to_obj(<gray>mesh, name='', out_path=application.compressed_models_folder, max_decimals=3</gray>)   
compress_internal()   

<div class="example"><blue>print</blue>(<green>'imported_meshes:\n'</green>, imported_meshes)

application.asset_folder = application.asset_folder.parent / <green>'samples'</green>
<purple>from</purple> ursina.shaders <purple>import</purple> normals_shader as rim_shader
<purple>from</purple> ursina.shaders <purple>import</purple> matcap_shader as rim_shader


t = time.time()
blender_scene = load_blender_scene(path=application.asset_folder, name=<green>'blender_level_editor_test_scene_2'</green>)


EditorCamera()
Sky(<olive>texture</olive>=<green>'sky_sunset'</green>)
</div>
</div></div>
<div id="scene"><div id="scene" style="color:hsl(20.0, 89%, 28%); font-size:1.75em; font-weight:normal;">scene</div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/scene.py"><gray>ursina.scene</gray></a><br><br>render<gray> = None</gray> 
world<gray> = None</gray> 
camera<gray> = None</gray> 
ui_camera<gray> = None</gray> 
entities<gray> = []</gray> 
hidden<gray> = NodePath('hidden')</gray> 
reflection_map<gray> = 'reflection_map_3'</gray> 
fog_color
fog_density

set_up()   
clear()   

<div class="example">e = <olive>Entity</olive>(<olive>model</olive>=<green>'plane'</green>, <olive>color</olive>=color.black, <olive>scale</olive>=<yellow>1</yellow><yellow>0</yellow><yellow>0</yellow>)
EditorCamera()
s = Sky()

<purple>def</purple> input(key):
    <purple>if</purple> key == <green>'l'</green>:
        <purple>for</purple> e in scene.entities:
            <blue>print</blue>(e.name)

    <purple>if</purple> key == <green>'d'</green>:
        scene.clear()

scene.fog_density = .1          <gray># sets exponential density</gray>
scene.fog_density = (50, 200)   <gray># sets linear density start and end</gray>
</div>
</div></div>
<div id="shader"><div id="shader" style="color:hsl(20.0, 89%, 28%); font-size:1.75em; font-weight:normal;">shader</div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/shader.py"><gray>ursina.shader</gray></a><br><br>uniform mat4 p3d_ModelViewProjectionMatrix;
out vec2 uv;
void main() {
}
uniform sampler2D tex;
out vec4 color;
void main() {
}


<div class="example"><purple>from</purple> time <purple>import</purple> perf_counter
t = perf_counter()
<olive>Entity</olive>(<olive>model</olive>=<green>'cube'</green>, <olive>shader</olive>=Shader())
EditorCamera()
<blue>print</blue>(<green>'ttttttttttttt'</green>, perf_counter() - t)
<purple>def</purple> input(key):
    <purple>if</purple> held_keys[<green>'control'</green>] and key == <green>'r'</green>:
        reload_shaders()

<purple>def</purple> reload_shaders():
    <purple>for</purple> e in scene.entities:
        <purple>if</purple> <blue>hasattr</blue>(e, <green>'_shader'</green>):
            <blue>print</blue>(<green>'-------'</green>, e.shader)
</div>
</div></div>
<div id="string_utilities"><div id="string_utilities" style="color:hsl(20.0, 89%, 28%); font-size:1.75em; font-weight:normal;">string_utilities</div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/string_utilities.py"><gray>ursina.string_utilities</gray></a><br><br>
camel_to_snake(<gray>value</gray>)   
snake_to_camel(<gray>value</gray>)   
multireplace(<gray>string, replacements, ignore_case=False</gray>)   
printvar(<gray>var</gray>)   

<div class="example"><blue>print</blue>(camel_to_snake(<green>'CamelToSnake'</green>))
<blue>print</blue>(snake_to_camel(<green>'snake_to_camel'</green>))
printvar(<green>'test'</green>)
</div>
</div></div>
<div id="text"><div id="text" style="color:hsl(20.0, 89%, 28%); font-size:1.75em; font-weight:normal;">text</div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/text.py"><gray>ursina.text</gray></a><br><br>
get_width(<gray>string, font=None</gray>)   

<div class="example"><purple>from</purple> ursina <purple>import</purple> *
  app = Ursina()
  descr = dedent(<green><green>''</green>'
      &ltscale:1.5&gt&ltorange&gtRainstorm&ltdefault&gt&ltscale:1&gt
      Summon a &ltazure&gtrain storm &ltdefault&gtto deal 5 &ltazure&gtwater

      damage &ltdefault&gtto &lthsb(0,1,.7)&gteveryone, &ltdefault&gt&ltimage:file_icon&gt &ltred&gt&ltimage:file_icon&gt test &ltdefault&gtincluding &ltorange&gtyourself. &ltdefault&gt
      Lasts for 4 rounds.<green>''</green>'</green>).strip()

  Text.default_resolution = <yellow>1</yellow><yellow>0</yellow><yellow>8</yellow><yellow>0</yellow> * Text.size
  test = Text(<olive>origin</olive>=(.<yellow>5</yellow>,.<yellow>5</yellow>), <olive>text</olive>=descr)


  text = Text(<olive>text</olive>=descr, wordwrap=<yellow>1</yellow><yellow>0</yellow>, <olive>origin</olive>=(-.<yellow>5</yellow>,.<yellow>5</yellow>), <olive>y</olive>=.<yellow>2</yellow><yellow>5</yellow>, background=True)
  <olive>Entity</olive>(<olive>parent</olive>=camera.ui, <olive>model</olive>=<green>'circle'</green>, <olive>scale</olive>=.<yellow>0</yellow><yellow>5</yellow>, <olive>color</olive>=color.yellow, <olive>y</olive>=text.y, <olive>z</olive>=-<yellow>1</yellow>)


  <purple>def</purple> input(key):
      <purple>if</purple> key == <green>'a'</green>:
          test.appear(speed=.<yellow>0</yellow><yellow>2</yellow><yellow>5</yellow>)

  test.create_background()

  <blue>print</blue>(<green>'....'</green>, Text.get_width(<green>'yolo'</green>))
  app.run()
</div>
</div></div>
<div id="texture_importer"><div id="texture_importer" style="color:hsl(20.0, 89%, 28%); font-size:1.75em; font-weight:normal;">texture_importer</div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/texture_importer.py"><gray>ursina.texture_importer</gray></a><br><br>file_types<gray> = ('.tif', '.jpg', '.jpeg', '.png', '.gif')</gray> 
textureless<gray> = False</gray> 

load_texture(<gray>name, path=None</gray>)   
compress_textures(<gray>name=''</gray>)   

<div class="example"><olive>Entity</olive>(<olive>model</olive>=<green>'quad'</green>, <olive>texture</olive>=<green>'white_cube'</green>)
</div>
</div></div>
<div id="ursinamath"><div id="ursinamath" style="color:hsl(20.0, 89%, 28%); font-size:1.75em; font-weight:normal;">ursinamath</div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursinamath.py"><gray>ursinamath</gray></a><br><br>
distance(<gray>a, b</gray>)   
distance2d(<gray>a, b</gray>)   
distance_xz(<gray>a, b</gray>)   
lerp(<gray>a, b, t</gray>)   
inverselerp(<gray>a, b, t</gray>)   
clamp(<gray>value, floor, ceiling</gray>)   
round_to_closest(<gray>value, step=0</gray>)   
chunk_list(<gray>l, chunk_size</gray>)   
size_list()   
sum(<gray>l</gray>)   

<div class="example">e<yellow>1</yellow> = <olive>Entity</olive>(position = (<yellow>0</yellow>,<yellow>0</yellow>,<yellow>0</yellow>))
e<yellow>2</yellow> = <olive>Entity</olive>(position = (<yellow>0</yellow>,<yellow>1</yellow>,<yellow>1</yellow>))
distance(e<yellow>1</yellow>, e<yellow>2</yellow>)
distance_xz(e<yellow>1</yellow>, e<yellow>2</yellow>.position)

between_color = lerp(color.lime, color.magenta, .<yellow>5</yellow>)
<blue>print</blue>(between_color)
<blue>print</blue>(lerp((<yellow>0</yellow>,<yellow>0</yellow>), (<yellow>0</yellow>,<yellow>1</yellow>), .<yellow>5</yellow>))
<blue>print</blue>(lerp(Vec2(<yellow>0</yellow>,<yellow>0</yellow>), Vec2(<yellow>0</yellow>,<yellow>1</yellow>), .<yellow>5</yellow>))
<blue>print</blue>(lerp([<yellow>0</yellow>,<yellow>0</yellow>], [<yellow>0</yellow>,<yellow>1</yellow>], .<yellow>5</yellow>))

<blue>print</blue>(round(Vec3(.<yellow>3</yellow><yellow>8</yellow>, .<yellow>1</yellow><yellow>3</yellow><yellow>5</yellow><yellow>1</yellow>, <yellow>3</yellow><yellow>5</yellow><yellow>3</yellow>.<yellow>2</yellow><yellow>6</yellow>), <yellow>2</yellow>))
</div>
</div></div>
<div id="ursinastuff"><div id="ursinastuff" style="color:hsl(20.0, 89%, 28%); font-size:1.75em; font-weight:normal;">ursinastuff</div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursinastuff.py"><gray>ursinastuff</gray></a><br><br>
invoke(<gray>function, *args, **kwargs</gray>)   
destroy(<gray>entity, delay=0</gray>)   
find_sequence(<gray>name, file_types, folders</gray>)   <gray># find frame_0, frame_1, frame_2 and so on</gray>
import_all_classes(<gray>path=application.asset_folder, debug=False</gray>)   
print_on_screen(<gray>text, position=window.top_left, origin=(-.5,.5), scale=1, duration=1</gray>)   

<div class="example"><purple>def</purple> test_func(item, x=None, <olive>y</olive>=None):
    <blue>print</blue>(item, x, y)

test_func(<green>'test'</green>)
invoke(test_func, <green>'test'</green>, dela<olive>y</olive>=.<yellow>1</yellow>)
invoke(test_func, <green>'test1'</green>, <yellow>1</yellow>, <yellow>2</yellow>, dela<olive>y</olive>=.<yellow>2</yellow>)
invoke(test_func, <green>'test2'</green>, x=<yellow>1</yellow>, <olive>y</olive>=<yellow>2</yellow>, dela<olive>y</olive>=.<yellow>3</yellow>)

<purple>def</purple> input(key):
    <purple>if</purple> key == <green>'space'</green>:
        print_on_screen(<green>'debug message'</green>, <olive>position</olive>=(<yellow>0</yellow>,<yellow>0</yellow>), <olive>origin</olive>=(<yellow>0</yellow>,<yellow>0</yellow>), <olive>scale</olive>=<yellow>2</yellow>)
</div>
</div></div>
<div id="window"><div id="window" style="color:hsl(20.0, 89%, 28%); font-size:1.75em; font-weight:normal;">window</div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/window.py"><gray>ursina.window</gray></a><br><br>vsync<gray> = True   # can't be set during play</gray> 
show_ursina_splash<gray> = False</gray> 
title<gray> = application.asset_folder.name</gray> 
fullscreen_size<gray> = Vec2(self.screen_resolution[0]+1, self.screen_resolution[1]+1)</gray> 
windowed_size<gray> = self.fullscreen_size / 1.25</gray> 
windowed_position<gray> = None   # gets set when entering fullscreen so position will be correct when going back to windowed mode</gray> 
size<gray> = self.windowed_size</gray> 
borderless<gray> = True</gray> 
top<gray> = Vec2(0, .5)</gray> 
bottom<gray> = Vec2(0, -.5)</gray> 
center<gray> = Vec2(0, 0)</gray> 
color<gray> = color.dark_gray</gray> 
render_modes<gray> = ('default', 'wireframe', 'colliders', 'normals')</gray> 
render_mode<gray> = 'default'</gray> 
editor_ui<gray> = None</gray> 
left
right
top_left
top_right
bottom_left
bottom_right
position
icon

late_init()   
center_on_screen()   
make_editor_gui()   <gray># called by main after setting up camera and application.development_mode</gray>
update_aspect_ratio()   
next_render_mode()   

<div class="example">window.vsync = <yellow>3</yellow><yellow>0</yellow>

window.title = <green>'Title'</green>
window.borderless = False
camera.orthographic = True
camera.fov = <yellow>2</yellow>

<olive>Entity</olive>(<olive>model</olive>=<green>'cube'</green>, <olive>color</olive>=color.green, <olive>collider</olive>=<green>'box'</green>, <olive>texture</olive>=<green>'shore'</green>)
</div>
</div></div>
<div id="Audio"><div id="Audio" style="color:hsl(349.0, 89%, 28%); font-size:1.75em; font-weight:normal;">Audio<gray>(<a style="color: gray;" href="#Entity">Entity</a>)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/audio.py"><gray>ursina.audio</gray></a><br><br><params class="params">Audio(sound_file_name='', autoplay=True, **kwargs)</params>

volume<gray> = 1</gray> 
pitch<gray> = 1</gray> 
balance<gray> = 0</gray> 
loop<gray> = False</gray> 
loops<gray> = 1</gray> 
autoplay<gray> = autoplay</gray> 
clip
length
status
ready
playing
time

play(<gray>start=0</gray>)   
pause()   
resume()   
stop(<gray>destroy=True</gray>)   
fade(<gray>value, duration=.5, delay=0, curve=curve.in_expo, resolution=None, interrupt=True</gray>)   
fade_in(<gray>value=1, duration=.5, delay=0, curve=curve.in_expo, resolution=None, interrupt='finish',</gray>)   
fade_out(<gray>value=0, duration=.5, delay=0, curve=curve.in_expo, resolution=None, interrupt='finish',</gray>)   

<div class="example"><purple>from</purple> ursina <purple>import</purple> Ursina, printvar

a = <purple><b>Audio</b></purple>(<green>'life_is_currency'</green>, pitch=<yellow>1</yellow>, loop=True, autopla<olive>y</olive>=True)
<blue>print</blue>(a.clip)
a.volume=<yellow>0</yellow>
b = <purple><b>Audio</b></purple>(a.clip)

<purple>def</purple> input(key):
    <purple>if</purple> key == <green>'f'</green>:
        a.fade_out(duration=<yellow>4</yellow>, <olive>curve</olive>=curve.linear)
</div>
</div></div>
<div id="Collider"><div id="Collider" style="color:hsl(349.0, 89%, 28%); font-size:1.75em; font-weight:normal;">Collider<gray>()</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/collider.py"><gray>ursina.collider</gray></a><br><br><params class="params">Collider()</params>

visible

show()   
hide()   
remove()   

<div class="example">e = <olive>Entity</olive>(<olive>model</olive>=<green>'sphere'</green>, x=<yellow>2</yellow>)
e.collider = <green>'box'</green>      <gray># add BoxCollider based on entity's bounds.</gray>
e.collider = <green>'sphere'</green>   <gray># add SphereCollider based on entity's bounds.</gray>
e.collider = <green>'mesh'</green>     <gray># add MeshCollider based on entity's bounds.</gray>

e.collider = Box<b>Collider</b>(e, center=Vec3(0,0,0), size=Vec3(1,1,1))   <gray># add BoxCollider at custom positions and size.</gray>
e.collider = Sphere<b>Collider</b>(e, center=Vec3(0,0,0), radius=.75)      <gray># add SphereCollider at custom positions and size.</gray>
e.collider = Mesh<b>Collider</b>(e, mesh=e.model, center=Vec3(0,0,0))      <gray># add MeshCollider with custom shape and center.</gray>

m = Prismatoid(base_shape=Circle(<yellow>6</yellow>), thicknesses=(<yellow>1</yellow>, .<yellow>5</yellow>))
e = Button(<olive>parent</olive>=scene, <olive>model</olive>=m, <olive>collider</olive>=<green>'mesh'</green>, <olive>color</olive>=color.red, <olive>highlight_color</olive>=color.yellow)

EditorCamera()
</div>
</div></div>
<div id="BoxCollider"><div id="BoxCollider" style="color:hsl(349.0, 89%, 28%); font-size:1.75em; font-weight:normal;">BoxCollider<gray>(<a style="color: gray;" href="#Collider">Collider</a>)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/collider.py"><gray>ursina.collider</gray></a><br><br><params class="params">BoxCollider(entity, center=(0,0,0), size=(1,1,1))</params>

shape<gray> = CollisionBox(Vec3(center[0], center[1], center[2]), size[0], size[1], size[2])</gray> 
collision_node<gray> = CollisionNode('CollisionNode')</gray> 
node_path<gray> = entity.attachNewNode(self.collision_node)</gray> 
visible<gray> = False</gray> 


<div class="example">e = <olive>Entity</olive>(<olive>model</olive>=<green>'sphere'</green>, x=<yellow>2</yellow>)
e.collider = <green>'box'</green>      <gray># add BoxCollider based on entity's bounds.</gray>
e.collider = <green>'sphere'</green>   <gray># add SphereCollider based on entity's bounds.</gray>
e.collider = <green>'mesh'</green>     <gray># add MeshCollider based on entity's bounds.</gray>

e.collider = <b>BoxCollider</b>(e, center=Vec3(0,0,0), size=Vec3(1,1,1))   <gray># add BoxCollider at custom positions and size.</gray>
e.collider = SphereCollider(e, center=Vec3(0,0,0), radius=.75)      <gray># add SphereCollider at custom positions and size.</gray>
e.collider = MeshCollider(e, mesh=e.model, center=Vec3(0,0,0))      <gray># add MeshCollider with custom shape and center.</gray>

m = Prismatoid(base_shape=Circle(<yellow>6</yellow>), thicknesses=(<yellow>1</yellow>, .<yellow>5</yellow>))
e = Button(<olive>parent</olive>=scene, <olive>model</olive>=m, <olive>collider</olive>=<green>'mesh'</green>, <olive>color</olive>=color.red, <olive>highlight_color</olive>=color.yellow)

EditorCamera()
</div>
</div></div>
<div id="SphereCollider"><div id="SphereCollider" style="color:hsl(349.0, 89%, 28%); font-size:1.75em; font-weight:normal;">SphereCollider<gray>(<a style="color: gray;" href="#Collider">Collider</a>)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/collider.py"><gray>ursina.collider</gray></a><br><br><params class="params">SphereCollider(entity, center=(0,0,0), radius=.5)</params>

shape<gray> = CollisionSphere(center[0], center[1], center[2], radius)</gray> 
node_path<gray> = entity.attachNewNode(CollisionNode('CollisionNode'))</gray> 
visible<gray> = False</gray> 


<div class="example">e = <olive>Entity</olive>(<olive>model</olive>=<green>'sphere'</green>, x=<yellow>2</yellow>)
e.collider = <green>'box'</green>      <gray># add BoxCollider based on entity's bounds.</gray>
e.collider = <green>'sphere'</green>   <gray># add SphereCollider based on entity's bounds.</gray>
e.collider = <green>'mesh'</green>     <gray># add MeshCollider based on entity's bounds.</gray>

e.collider = BoxCollider(e, center=Vec3(0,0,0), size=Vec3(1,1,1))   <gray># add BoxCollider at custom positions and size.</gray>
e.collider = <b>SphereCollider</b>(e, center=Vec3(0,0,0), radius=.75)      <gray># add SphereCollider at custom positions and size.</gray>
e.collider = MeshCollider(e, mesh=e.model, center=Vec3(0,0,0))      <gray># add MeshCollider with custom shape and center.</gray>

m = Prismatoid(base_shape=Circle(<yellow>6</yellow>), thicknesses=(<yellow>1</yellow>, .<yellow>5</yellow>))
e = Button(<olive>parent</olive>=scene, <olive>model</olive>=m, <olive>collider</olive>=<green>'mesh'</green>, <olive>color</olive>=color.red, <olive>highlight_color</olive>=color.yellow)

EditorCamera()
</div>
</div></div>
<div id="MeshCollider"><div id="MeshCollider" style="color:hsl(349.0, 89%, 28%); font-size:1.75em; font-weight:normal;">MeshCollider<gray>(<a style="color: gray;" href="#Collider">Collider</a>)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/collider.py"><gray>ursina.collider</gray></a><br><br><params class="params">MeshCollider(entity, mesh=None, center=(0,0,0))</params>

node_path<gray> = entity.attachNewNode(CollisionNode('CollisionNode'))</gray> 
node<gray> = self.node_path.node()</gray> 
collision_polygons<gray> = list()</gray> 
visible<gray> = False</gray> 


<div class="example">e = <olive>Entity</olive>(<olive>model</olive>=<green>'sphere'</green>, x=<yellow>2</yellow>)
e.collider = <green>'box'</green>      <gray># add BoxCollider based on entity's bounds.</gray>
e.collider = <green>'sphere'</green>   <gray># add SphereCollider based on entity's bounds.</gray>
e.collider = <green>'mesh'</green>     <gray># add MeshCollider based on entity's bounds.</gray>

e.collider = BoxCollider(e, center=Vec3(0,0,0), size=Vec3(1,1,1))   <gray># add BoxCollider at custom positions and size.</gray>
e.collider = SphereCollider(e, center=Vec3(0,0,0), radius=.75)      <gray># add SphereCollider at custom positions and size.</gray>
e.collider = <b>MeshCollider</b>(e, mesh=e.model, center=Vec3(0,0,0))      <gray># add MeshCollider with custom shape and center.</gray>

m = Prismatoid(base_shape=Circle(<yellow>6</yellow>), thicknesses=(<yellow>1</yellow>, .<yellow>5</yellow>))
e = Button(<olive>parent</olive>=scene, <olive>model</olive>=m, <olive>collider</olive>=<green>'mesh'</green>, <olive>color</olive>=color.red, <olive>highlight_color</olive>=color.yellow)

EditorCamera()
</div>
</div></div>
<div id="CollisionZone"><div id="CollisionZone" style="color:hsl(349.0, 89%, 28%); font-size:1.75em; font-weight:normal;">CollisionZone<gray>(<a style="color: gray;" href="#Entity">Entity</a>)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/collision_zone.py"><gray>ursina.collision_zone</gray></a><br><br><params class="params">CollisionZone(radius=2, target_entities=None, **kwargs)</params>

radius<gray> = radius</gray> 
entities_with_mesh_colliders<gray> = target_entities # defaults to all entities with a mesh collider</gray> 

update()   
update_colliders()   

<div class="example"><green><green>''</green>'
This will only enable mesh colliders' collision polygons within a certain range,
in order to improve performance.
<green>''</green>'</green>

<purple>from</purple> ursina.shaders <purple>import</purple> basic_lighting_shader
window.vsync = False

application.asset_folder = application.asset_folder.parent
terrain = <olive>Entity</olive>(<olive>model</olive>=<green>'heightmap_test'</green>, <olive>scale</olive>=<yellow>3</yellow><yellow>2</yellow>, <olive>texture</olive>=<green>'grass'</green>, <olive>collider</olive>=<green>'mesh'</green>, <olive>shader</olive>=basic_lighting_shader)
<purple>from</purple> ursina.prefabs.first_person_controller <purple>import</purple> FirstPersonController
player = FirstPersonController(speed=<yellow>1</yellow><yellow>0</yellow>)
collision_zone = <purple><b>CollisionZone</b></purple>(<olive>parent</olive>=player, radius=<yellow>3</yellow><yellow>2</yellow>)


<purple>def</purple> input(key):
    <purple>if</purple> key == <green>'c'</green>:
        terrain.collision = <purple>not</purple> terrain.collision



Sky()
base.set_frame_rate_meter(True)
</div>
</div></div>
<div id="Color"><div id="Color" style="color:hsl(349.0, 89%, 28%); font-size:1.75em; font-weight:normal;">Color<gray>(Vec4)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/color.py"><gray>ursina.color</gray></a><br><br><params class="params">Color(self,*p)</params>

name
r
g
b
a
hsv
h
s
v
brightness

invert()   
tint(<gray>amount</gray>)   
hsv(<gray>h, s, v, a=1</gray>)   
rgba(<gray>r, g, b, a=255</gray>)   
rgb(<gray>r, g, b, a=255</gray>)   
to_hsv(<gray>color</gray>)   
hex(<gray>value</gray>)   
brightness(<gray>color</gray>)   
inverse(<gray>color</gray>)   
random_color()   
tint(<gray>color, amount=.2</gray>)   

<div class="example"><blue>print</blue>(color.brightness(color.blue))
<blue>print</blue>(_<yellow>3</yellow>)

p = <olive>Entity</olive>(x=-<yellow>2</yellow>)
<purple>for</purple> key in color.colors:
    <blue>print</blue>(key)
    b = Button(<olive>parent</olive>=p, <olive>model</olive>=Quad(subdivisions=<yellow>2</yellow>), <olive>color</olive>=color.colors[key], <olive>text</olive>=key)
    b.text_entity.scale *= .<yellow>5</yellow>

grid_layout(p.children, max_x=<yellow>8</yellow>)

<purple>for</purple> name in (<green>'r'</green>, <green>'g'</green>, <green>'b'</green>, <green>'h'</green>, <green>'s'</green>, <green>'v'</green>, <green>'brightness'</green>):
    <blue>print</blue>(name + <green>':'</green>, <blue>getattr</blue>(color.random_color(), name))

e = <olive>Entity</olive>(<olive>model</olive>=<green>'cube'</green>, <olive>color</olive>=color.lime)
<blue>print</blue>(e.color.name)
</div>
</div></div>
<div id="CubicBezier"><div id="CubicBezier" style="color:hsl(349.0, 89%, 28%); font-size:1.75em; font-weight:normal;">CubicBezier</div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/curve.py"><gray>ursina.curve</gray></a><br><br><params class="params">CubicBezier(a, b, c, d)</params>

a<gray> = a</gray> 
b<gray> = b</gray> 
c<gray> = c</gray> 
d<gray> = d</gray> 
cx<gray> = 3.0 * a</gray> 
bx<gray> = 3.0 * (c - a) - self.cx</gray> 
ax<gray> = 1.0 - self.cx - self.bx</gray> 
cy<gray> = 3.0 * b</gray> 
by<gray> = 3.0 * (d - b) - self.cy</gray> 
ay<gray> = 1.0 - self.cy - self.by</gray> 

sample_curve_x(<gray>t</gray>)   
sample_curve_y(<gray>t</gray>)   
sample_curve_derivative_x(<gray>t</gray>)   
calculate(<gray>x, epsilon=.0001</gray>)   
solve_curve_x(<gray>t, epsilon=.0001</gray>)   

<div class="example"><green><green><green>''</green></green>'Draws a sheet with every curve and its name<green><green>''</green></green>'</green>

camera.orthographic = True
camera.fov = <yellow>1</yellow><yellow>6</yellow>
camera.position = (<yellow>9</yellow>, <yellow>6</yellow>)
window.color = color.black

i = <yellow>0</yellow>
<purple>for</purple> e in dir(curve):
    try:
        item = <blue>getattr</blue>(curve, e)
        <blue>print</blue>(item.__name__, <green>':'</green>, item(.<yellow>7</yellow><yellow>5</yellow>))
        curve_renderer = <olive>Entity</olive>(
            <olive>model</olive>=Mesh(<olive>vertices</olive>=[Vec3(i / <yellow>3</yellow><yellow>1</yellow>, item(i / <yellow>3</yellow><yellow>1</yellow>), <yellow>0</yellow>) <purple>for</purple> i in <blue>range</blue>(<yellow>3</yellow><yellow>2</yellow>)], <olive>mode</olive>=<green>'line'</green>, <olive>thickness</olive>=<yellow>2</yellow>),
            <olive>color</olive>=color.light_gray)
        row = floor(i / <yellow>8</yellow>)
        curve_renderer.x = (i % <yellow>8</yellow>) * <yellow>2</yellow>.<yellow>5</yellow>
        curve_renderer.y = row * <yellow>1</yellow>.<yellow>7</yellow><yellow>5</yellow>
        label = Text(<olive>parent</olive>=curve_renderer, <olive>text</olive>=item.__name__, <olive>scale</olive>=<yellow>8</yellow>, <olive>color</olive>=color.gray, <olive>y</olive>=-.<yellow>1</yellow>)
        i += <yellow>1</yellow>
    except:
        pass

c = <purple><b>CubicBezier</b></purple>(<yellow>0</yellow>, .<yellow>5</yellow>, <yellow>1</yellow>, .<yellow>5</yellow>)
<blue>print</blue>(<green>'-----------'</green>, c.calculate(.<yellow>2</yellow><yellow>3</yellow>))

window.exit_button.visible = False
window.fps_counter.enabled = False
<green><green>''</green>'
These are used by Entity when animating, like this:

e = Entity()
e.animate_y(1, curve=curve.in_expo)

e2 = Entity(x=1.5)
e2.animate_y(1, curve=curve.<b>CubicBezier</b>(0,.7,1,.3))
<green>''</green>'</green>
</div>
</div></div>
<div id="HitInfo"><div id="HitInfo" style="color:hsl(349.0, 89%, 28%); font-size:1.75em; font-weight:normal;">HitInfo</div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/hit_info.py"><gray>ursina.hit_info</gray></a><br><br><params class="params">HitInfo(**kwargs)</params>

hit<gray> = None</gray> 
entity<gray> = None</gray> 
point<gray> = None</gray> 
world_point<gray> = None</gray> 
distance<gray> = math.inf</gray> 
normal<gray> = None</gray> 
world_normal<gray> = None</gray> 
hits<gray> = []</gray> 
entities<gray> = []</gray> 


</div></div>
<div id="Keys"><div id="Keys" style="color:hsl(349.0, 89%, 28%); font-size:1.75em; font-weight:normal;">Keys<gray>(Enum)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/input_handler.py"><gray>ursina.input_handler</gray></a><br><br>left_mouse_down<gray> = 'left mouse down'</gray> 
left_mouse_up<gray> = 'left mouse up'</gray> 
middle_mouse_down<gray> = 'middle mouse down'</gray> 
middle_mouse_up<gray> = 'middle mouse up'</gray> 
right_mouse_down<gray> = 'right mouse down'</gray> 
right_mouse_up<gray> = 'right mouse up'</gray> 
scroll_up<gray> = 'scroll up'</gray> 
scroll_down<gray> = 'scroll down'</gray> 
left_arrow<gray> = 'left arrow'</gray> 
left_arrow_up<gray> = 'left arrow up'</gray> 
up_arrow<gray> = 'up arrow'</gray> 
up_arrow_up<gray> = 'up arrow up'</gray> 
down_arrow<gray> = 'down arrow'</gray> 
down_arrow_up<gray> = 'down arrow up'</gray> 
right_arrow<gray> = 'right arrow'</gray> 
right_arrow_up<gray> = 'right arrow up'</gray> 
left_control<gray> = 'left control'</gray> 
right_control<gray> = 'right control'</gray> 
left_shift<gray> = 'left shift'</gray> 
right_shift<gray> = 'right shift'</gray> 
left_alt<gray> = 'left alt'</gray> 
right_alt<gray> = 'right alt'</gray> 
left_control_up<gray> = 'left control up'</gray> 
right_control_up<gray> = 'right control up'</gray> 
left_shift_up<gray> = 'left shift up'</gray> 
right_shift_up<gray> = 'right shift up'</gray> 
left_alt_up<gray> = 'left alt up'</gray> 
right_alt_up<gray> = 'right alt up'</gray> 
page_down<gray> = 'page down'</gray> 
page_down_up<gray> = 'page down up'</gray> 
page_up<gray> = 'page up'</gray> 
page_up_up<gray> = 'page up up'</gray> 
enter<gray> = 'enter'</gray> 
backspace<gray> = 'backspace'</gray> 
escape<gray> = 'escape'</gray> 
tab<gray> = 'tab'</gray> 
gamepad_a<gray> = 'gamepad a'</gray> 
gamepad_a_up<gray> = 'gamepad a up'</gray> 
gamepad_b<gray> = 'gamepad b'</gray> 
gamepad_b_up<gray> = 'gamepad b up'</gray> 
gamepad_x<gray> = 'gamepad x'</gray> 
gamepad_x_up<gray> = 'gamepad x up'</gray> 
gamepad_y<gray> = 'gamepad y'</gray> 
gamepad_y_up<gray> = 'gamepad y up'</gray> 
gamepad_left_stick<gray> = 'gamepad left stick'</gray> 
gamepad_left_stick_up<gray> = 'gamepad left stick up'</gray> 
gamepad_right_stick<gray> = 'gamepad right stick'</gray> 
gamepad_right_stick_up<gray> = 'gamepad right stick up'</gray> 
gamepad_back<gray> = 'gamepad back'</gray> 
gamepad_back_up<gray> = 'gamepad back up'</gray> 
gamepad_start<gray> = 'gamepad start'</gray> 
gamepad_dpad_down<gray> = 'gamepad dpad down'</gray> 
gamepad_dpad_down_up<gray> = 'gamepad dpad down up'</gray> 
gamepad_dpad_up<gray> = 'gamepad dpad up'</gray> 
gamepad_dpad_up_up<gray> = 'gamepad dpad up up'</gray> 
gamepad_dpad_left<gray> = 'gamepad dpad left'</gray> 
gamepad_dpad_left_up<gray> = 'gamepad dpad left up'</gray> 
gamepad_dpad_right<gray> = 'gamepad dpad right'</gray> 
gamepad_dpad_right_up<gray> = 'gamepad dpad right up'</gray> 
gamepad_left_shoulder<gray> = 'gamepad left shoulder'</gray> 
gamepad_left_shoulder_up<gray> = 'gamepad left shoulder up'</gray> 
gamepad_right_shoulder<gray> = 'gamepad right shoulder'</gray> 
gamepad_right_shoulder_up<gray> = 'gamepad right shoulder up'</gray> 


</div></div>
<div id="Light"><div id="Light" style="color:hsl(349.0, 89%, 28%); font-size:1.75em; font-weight:normal;">Light<gray>(<a style="color: gray;" href="#Entity">Entity</a>)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/lights.py"><gray>ursina.lights</gray></a><br><br><params class="params">Light(**kwargs)</params>

color


<div class="example">from ursina.shaders import lit_with_shadows_shader <gray># you have to apply this shader to enties for them to recieve shadows.</gray>
EditorCamera()
<olive>Entity</olive>(<olive>model</olive>=<green>'plane'</green>, <olive>scale</olive>=<yellow>1</yellow><yellow>0</yellow>, <olive>color</olive>=color.gray, <olive>shader</olive>=lit_with_shadows_shader)
<olive>Entity</olive>(<olive>model</olive>=<green>'cube'</green>, <olive>y</olive>=<yellow>1</yellow>, <olive>shader</olive>=lit_with_shadows_shader)
pivot = <olive>Entity</olive>()
Directional<purple><b>Light</b></purple>(<olive>parent</olive>=pivot, <olive>y</olive>=<yellow>2</yellow>, <olive>z</olive>=<yellow>3</yellow>, shadows=True)
</div>
</div></div>
<div id="DirectionalLight"><div id="DirectionalLight" style="color:hsl(349.0, 89%, 28%); font-size:1.75em; font-weight:normal;">DirectionalLight<gray>(Light)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/lights.py"><gray>ursina.lights</gray></a><br><br><params class="params">DirectionalLight(shadows=True, **kwargs)</params>

shadow_map_resolution<gray> = Vec2(1024, 1024)</gray> 
shadows


<div class="example">from ursina.shaders import lit_with_shadows_shader <gray># you have to apply this shader to enties for them to recieve shadows.</gray>
EditorCamera()
<olive>Entity</olive>(<olive>model</olive>=<green>'plane'</green>, <olive>scale</olive>=<yellow>1</yellow><yellow>0</yellow>, <olive>color</olive>=color.gray, <olive>shader</olive>=lit_with_shadows_shader)
<olive>Entity</olive>(<olive>model</olive>=<green>'cube'</green>, <olive>y</olive>=<yellow>1</yellow>, <olive>shader</olive>=lit_with_shadows_shader)
pivot = <olive>Entity</olive>()
<purple><b>DirectionalLight</b></purple>(<olive>parent</olive>=pivot, <olive>y</olive>=<yellow>2</yellow>, <olive>z</olive>=<yellow>3</yellow>, shadows=True)
</div>
</div></div>
<div id="PointLight"><div id="PointLight" style="color:hsl(349.0, 89%, 28%); font-size:1.75em; font-weight:normal;">PointLight<gray>(Light)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/lights.py"><gray>ursina.lights</gray></a><br><br><params class="params">PointLight(**kwargs)</params>



<div class="example">from ursina.shaders import lit_with_shadows_shader <gray># you have to apply this shader to enties for them to recieve shadows.</gray>
EditorCamera()
<olive>Entity</olive>(<olive>model</olive>=<green>'plane'</green>, <olive>scale</olive>=<yellow>1</yellow><yellow>0</yellow>, <olive>color</olive>=color.gray, <olive>shader</olive>=lit_with_shadows_shader)
<olive>Entity</olive>(<olive>model</olive>=<green>'cube'</green>, <olive>y</olive>=<yellow>1</yellow>, <olive>shader</olive>=lit_with_shadows_shader)
pivot = <olive>Entity</olive>()
DirectionalLight(<olive>parent</olive>=pivot, <olive>y</olive>=<yellow>2</yellow>, <olive>z</olive>=<yellow>3</yellow>, shadows=True)
</div>
</div></div>
<div id="AmbientLight"><div id="AmbientLight" style="color:hsl(349.0, 89%, 28%); font-size:1.75em; font-weight:normal;">AmbientLight<gray>(Light)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/lights.py"><gray>ursina.lights</gray></a><br><br><params class="params">AmbientLight(**kwargs)</params>



<div class="example">from ursina.shaders import lit_with_shadows_shader <gray># you have to apply this shader to enties for them to recieve shadows.</gray>
EditorCamera()
<olive>Entity</olive>(<olive>model</olive>=<green>'plane'</green>, <olive>scale</olive>=<yellow>1</yellow><yellow>0</yellow>, <olive>color</olive>=color.gray, <olive>shader</olive>=lit_with_shadows_shader)
<olive>Entity</olive>(<olive>model</olive>=<green>'cube'</green>, <olive>y</olive>=<yellow>1</yellow>, <olive>shader</olive>=lit_with_shadows_shader)
pivot = <olive>Entity</olive>()
DirectionalLight(<olive>parent</olive>=pivot, <olive>y</olive>=<yellow>2</yellow>, <olive>z</olive>=<yellow>3</yellow>, shadows=True)
</div>
</div></div>
<div id="SpotLight"><div id="SpotLight" style="color:hsl(349.0, 89%, 28%); font-size:1.75em; font-weight:normal;">SpotLight<gray>(Light)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/lights.py"><gray>ursina.lights</gray></a><br><br><params class="params">SpotLight(**kwargs)</params>



<div class="example">from ursina.shaders import lit_with_shadows_shader <gray># you have to apply this shader to enties for them to recieve shadows.</gray>
EditorCamera()
<olive>Entity</olive>(<olive>model</olive>=<green>'plane'</green>, <olive>scale</olive>=<yellow>1</yellow><yellow>0</yellow>, <olive>color</olive>=color.gray, <olive>shader</olive>=lit_with_shadows_shader)
<olive>Entity</olive>(<olive>model</olive>=<green>'cube'</green>, <olive>y</olive>=<yellow>1</yellow>, <olive>shader</olive>=lit_with_shadows_shader)
pivot = <olive>Entity</olive>()
DirectionalLight(<olive>parent</olive>=pivot, <olive>y</olive>=<yellow>2</yellow>, <olive>z</olive>=<yellow>3</yellow>, shadows=True)
</div>
</div></div>
<div id="Ursina"><div id="Ursina" style="color:hsl(349.0, 89%, 28%); font-size:1.75em; font-weight:normal;">Ursina<gray>()</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/main.py"><gray>ursina.main</gray></a><br><br><params class="params">Ursina(**kwargs): # optional arguments: title, fullscreen, size, position, vsync, borderless, show_ursina_splash, render_mode, development_mode, editor_ui_enabled</params>

mouse<gray> = mouse</gray> 

input_up(<gray>key</gray>)   
input_hold(<gray>key</gray>)   
input(<gray>key</gray>)   
run()   

<div class="example">app = <purple><b>Ursina</b></purple>()
app.run()
</div>
</div></div>
<div id="MeshModes"><div id="MeshModes" style="color:hsl(349.0, 89%, 28%); font-size:1.75em; font-weight:normal;">MeshModes<gray>(Enum)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/mesh.py"><gray>ursina.mesh</gray></a><br><br>triangle<gray> = 'triangle'</gray> 
ngon<gray> = 'ngon'</gray> 
quad<gray> = 'quad'</gray> 
line<gray> = 'line'</gray> 
point<gray> = 'point'</gray> 
tristrip<gray> = 'tristrip'</gray> 


</div></div>
<div id="Mesh"><div id="Mesh" style="color:hsl(349.0, 89%, 28%); font-size:1.75em; font-weight:normal;">Mesh<gray>()</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/mesh.py"><gray>ursina.mesh</gray></a><br><br><params class="params">Mesh(vertices=None, triangles=None, colors=None, uvs=None, normals=None, static=True, mode='triangle', thickness=1)</params>

vertices<gray> = vertices</gray> 
triangles<gray> = triangles</gray> 
colors<gray> = colors</gray> 
uvs<gray> = uvs</gray> 
normals<gray> = normals</gray> 
static<gray> = static</gray> 
mode<gray> = mode</gray> 
thickness<gray> = thickness</gray> 
recipe

generate()   <gray># call this after setting some of the variables to update it</gray>
generate_normals(<gray>smooth=True</gray>)   
colorize(<gray>left=color.white, right=color.blue, down=color.red, up=color.green, back=color.white, forward=color.white, smooth=True, world_space=True</gray>)   
project_uvs(<gray>aspect_ratio=1, direction='forward'</gray>)   
clear(<gray>regenerate=True</gray>)   
save(<gray>name='', path=application.compressed_models_folder</gray>)   

<div class="example">verts = ((<yellow>0</yellow>,<yellow>0</yellow>,<yellow>0</yellow>), (<yellow>1</yellow>,<yellow>0</yellow>,<yellow>0</yellow>), (.<yellow>5</yellow>, <yellow>1</yellow>, <yellow>0</yellow>), (-.<yellow>5</yellow>,<yellow>1</yellow>,<yellow>0</yellow>))
tris = (<yellow>1</yellow>, <yellow>2</yellow>, <yellow>0</yellow>, <yellow>2</yellow>, <yellow>3</yellow>, <yellow>0</yellow>)
uvs = ((<yellow>1</yellow>.<yellow>0</yellow>, <yellow>0</yellow>.<yellow>0</yellow>), (<yellow>0</yellow>.<yellow>0</yellow>, <yellow>1</yellow>.<yellow>0</yellow>), (<yellow>0</yellow>.<yellow>0</yellow>, <yellow>0</yellow>.<yellow>0</yellow>), (<yellow>1</yellow>.<yellow>0</yellow>, <yellow>1</yellow>.<yellow>0</yellow>))
norms = ((<yellow>0</yellow>,<yellow>0</yellow>,-<yellow>1</yellow>),) * len(verts)
colors = (color.red, color.blue, color.lime, color.black)


e = <olive>Entity</olive>(<olive>model</olive>=<purple><b>Mesh</b></purple>(<olive>vertices</olive>=verts, <olive>triangles</olive>=tris, <olive>uvs</olive>=uvs, <olive>normals</olive>=norms, <olive>colors</olive>=colors), <olive>scale</olive>=<yellow>2</yellow>)
verts = (Vec3(<yellow>0</yellow>,<yellow>0</yellow>,<yellow>0</yellow>), Vec3(<yellow>0</yellow>,<yellow>1</yellow>,<yellow>0</yellow>), Vec3(<yellow>1</yellow>,<yellow>1</yellow>,<yellow>0</yellow>), Vec3(<yellow>2</yellow>,<yellow>2</yellow>,<yellow>0</yellow>), Vec3(<yellow>0</yellow>,<yellow>3</yellow>,<yellow>0</yellow>), Vec3(-<yellow>2</yellow>,<yellow>3</yellow>,<yellow>0</yellow>))
tris = ((<yellow>0</yellow>,<yellow>1</yellow>), (<yellow>3</yellow>,<yellow>4</yellow>,<yellow>5</yellow>))

lines = <olive>Entity</olive>(<olive>model</olive>=<purple><b>Mesh</b></purple>(<olive>vertices</olive>=verts, <olive>triangles</olive>=tris, <olive>mode</olive>=<green>'line'</green>, <olive>thickness</olive>=<yellow>4</yellow>), <olive>color</olive>=color.cyan, <olive>z</olive>=-<yellow>1</yellow>)
points = <olive>Entity</olive>(<olive>model</olive>=<purple><b>Mesh</b></purple>(<olive>vertices</olive>=verts, <olive>mode</olive>=<green>'point'</green>, <olive>thickness</olive>=.<yellow>0</yellow><yellow>5</yellow>), <olive>color</olive>=color.red, <olive>z</olive>=-<yellow>1</yellow>.<yellow>0</yellow><yellow>1</yellow>)
</div>
</div></div>
<div id="Wait"><div id="Wait" style="color:hsl(349.0, 89%, 28%); font-size:1.75em; font-weight:normal;">Wait<gray>()</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/sequence.py"><gray>ursina.sequence</gray></a><br><br><params class="params">Wait(duration)</params>

duration<gray> = duration</gray> 


<div class="example">e = <olive>Entity</olive>(<olive>model</olive>=<green>'quad'</green>)
s = Sequence(
    <yellow>1</yellow>,
    Func(print, <green>'one'</green>),
    Func(e.fade_out, duration=<yellow>1</yellow>),
    <yellow>1</yellow>,
    Func(print, <green>'two'</green>),
    Func(e.fade_in, duration=<yellow>1</yellow>),
    loop=True
    )

s.append(
    Func(print, <green>'appended to sequence'</green>)
    )

<purple>def</purple> input(key):
    actions = {<green>'s'</green> : s.start, <green>'f'</green> : s.finish, <green>'p'</green> : s.pause, <green>'r'</green> : s.resume}
    <purple>if</purple> key in actions:
        actions[key]()
</div>
</div></div>
<div id="Func"><div id="Func" style="color:hsl(349.0, 89%, 28%); font-size:1.75em; font-weight:normal;">Func<gray>()</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/sequence.py"><gray>ursina.sequence</gray></a><br><br><params class="params">Func(func, *args, **kwargs)</params>

func<gray> = func</gray> 
args<gray> = args</gray> 
kwargs<gray> = kwargs</gray> 
delay<gray> = 0</gray> 
finished<gray> = False</gray> 


<div class="example">e = <olive>Entity</olive>(<olive>model</olive>=<green>'quad'</green>)
s = Sequence(
    <yellow>1</yellow>,
    <purple><b>Func</b></purple>(print, <green>'one'</green>),
    <purple><b>Func</b></purple>(e.fade_out, duration=<yellow>1</yellow>),
    <yellow>1</yellow>,
    <purple><b>Func</b></purple>(print, <green>'two'</green>),
    <purple><b>Func</b></purple>(e.fade_in, duration=<yellow>1</yellow>),
    loop=True
    )

s.append(
    <purple><b>Func</b></purple>(print, <green>'appended to sequence'</green>)
    )

<purple>def</purple> input(key):
    actions = {<green>'s'</green> : s.start, <green>'f'</green> : s.finish, <green>'p'</green> : s.pause, <green>'r'</green> : s.resume}
    <purple>if</purple> key in actions:
        actions[key]()
</div>
</div></div>
<div id="Sequence"><div id="Sequence" style="color:hsl(349.0, 89%, 28%); font-size:1.75em; font-weight:normal;">Sequence<gray>()</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/sequence.py"><gray>ursina.sequence</gray></a><br><br><params class="params">Sequence(*args, **kwargs)</params>

args<gray> = list(args)</gray> 
t<gray> = 0</gray> 
time_step<gray> = Sequence.default_time_step</gray> 
duration<gray> = 0</gray> 
funcs<gray> = list()</gray> 
paused<gray> = True</gray> 
loop<gray> = False</gray> 
auto_destroy<gray> = True</gray> 
finished

generate()   
append(<gray>arg</gray>)   
extend(<gray>list</gray>)   
start()   
pause()   
resume()   
finish()   
kill()   
update()   

<div class="example">e = <olive>Entity</olive>(<olive>model</olive>=<green>'quad'</green>)
s = <purple><b>Sequence</b></purple>(
    <yellow>1</yellow>,
    Func(print, <green>'one'</green>),
    Func(e.fade_out, duration=<yellow>1</yellow>),
    <yellow>1</yellow>,
    Func(print, <green>'two'</green>),
    Func(e.fade_in, duration=<yellow>1</yellow>),
    loop=True
    )

s.append(
    Func(print, <green>'appended to sequence'</green>)
    )

<purple>def</purple> input(key):
    actions = {<green>'s'</green> : s.start, <green>'f'</green> : s.finish, <green>'p'</green> : s.pause, <green>'r'</green> : s.resume}
    <purple>if</purple> key in actions:
        actions[key]()
</div>
</div></div>
<div id="Shader"><div id="Shader" style="color:hsl(349.0, 89%, 28%); font-size:1.75em; font-weight:normal;">Shader</div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/shader.py"><gray>ursina.shader</gray></a><br><br><params class="params">Shader(language=Panda3dShader.SL_GLSL, vertex=default_vertex_shader, fragment=default_fragment_shader, geometry='', **kwargs)</params>

path<gray> = Path(_caller.filename)</gray> 
language<gray> = language</gray> 
vertex<gray> = vertex</gray> 
fragment<gray> = fragment</gray> 
geometry<gray> = geometry</gray> 
entity<gray> = None</gray> 
default_input<gray> = dict()</gray> 
compiled<gray> = False</gray> 

compile()   

<div class="example"><purple>from</purple> time <purple>import</purple> perf_counter
t = perf_counter()
<olive>Entity</olive>(<olive>model</olive>=<green>'cube'</green>, <olive>shader</olive>=<purple><b>Shader</b></purple>())
EditorCamera()
<blue>print</blue>(<green>'ttttttttttttt'</green>, perf_counter() - t)
<purple>def</purple> input(key):
    <purple>if</purple> held_keys[<green>'control'</green>] and key == <green>'r'</green>:
        reload_shaders()

<purple>def</purple> reload_shaders():
    <purple>for</purple> e in scene.entities:
        <purple>if</purple> <blue>hasattr</blue>(e, <green>'_shader'</green>):
            <blue>print</blue>(<green>'-------'</green>, e.shader)
</div>
</div></div>
<div id="Texture"><div id="Texture" style="color:hsl(349.0, 89%, 28%); font-size:1.75em; font-weight:normal;">Texture<gray>()</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/texture.py"><gray>ursina.texture</gray></a><br><br><params class="params">Texture(value)</params>

filtering<gray> = Texture.default_filtering      # None/'bilinear'/'mipmap' default: 'bilinear'</gray> 
name
size
width
height
pixels

get_pixel(<gray>x, y</gray>)   
get_pixels(<gray>start, end</gray>)   
set_pixel(<gray>x, y, color</gray>)   
apply()   
save(<gray>path</gray>)   

<div class="example"><green><green>''</green>'
    The Texture class rarely used manually but usually instantiated
    when assigning a texture to an Entity
    texture = <b>Texture</b>(path / PIL.Image / panda3d.core.Texture)

    A texture file can be a .png, .jpg or .psd.
    If it's a .psd it and no compressed version exists, it will compress it automatically.
<green>''</green>'</green>
e = <olive>Entity</olive>(<olive>model</olive>=<green>'quad'</green>, <olive>texture</olive>=<green>'brick'</green>)
e.texture.set_pixel(<yellow>0</yellow>, <yellow>2</yellow>, color.blue)
e.texture.apply()

<purple>for</purple> y in <blue>range</blue>(e.texture.height):
    <purple>for</purple> x in <blue>range</blue>(e.texture.width):
        <purple>if</purple> e.texture.get_pixel(x,y) == color.blue:
            <blue>print</blue>(<green>'found blue pixel at:'</green>, x, y)
</div>
</div></div>
<div id="Trigger"><div id="Trigger" style="color:hsl(349.0, 89%, 28%); font-size:1.75em; font-weight:normal;">Trigger<gray>(<a style="color: gray;" href="#Entity">Entity</a>)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/trigger.py"><gray>ursina.trigger</gray></a><br><br><params class="params">Trigger(**kwargs)</params>

trigger_targets<gray> = None</gray> 
radius<gray> = .5</gray> 
triggerers<gray> = list()</gray> 
update_rate<gray> = 4</gray> 

update()   

<div class="example">player = <olive>Entity</olive>(<olive>model</olive>=<green>'cube'</green>, <olive>color</olive>=color.azure, <olive>scale</olive>=.<yellow>0</yellow><yellow>5</yellow>)
<purple>def</purple> update():
    player.x += held_keys[<green>'d'</green>] * time.dt * <yellow>2</yellow>
    player.x -= held_keys[<green>'a'</green>] * time.dt * <yellow>2</yellow>

t = <purple><b>Trigger</b></purple>(trigger_targets=(player,), x=<yellow>1</yellow>, <olive>model</olive>=<green>'sphere'</green>, <olive>color</olive>=color.color(<yellow>0</yellow>,<yellow>1</yellow>,<yellow>1</yellow>,.<yellow>5</yellow>))
t.on_trigger_enter = Func(print, <green>'enter'</green>)
t.on_trigger_exit =  Func(print, <green>'exit'</green>)
t.on_trigger_stay =  Func(print, <green>'stay'</green>)
</div>
</div></div>
<div id="Empty"><div id="Empty" style="color:hsl(349.0, 89%, 28%); font-size:1.75em; font-weight:normal;">Empty<gray>()</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursinastuff.py"><gray>ursinastuff</gray></a><br><br><params class="params">Empty(**kwargs)</params>


invoke(<gray>function, *args, **kwargs</gray>)   
destroy(<gray>entity, delay=0</gray>)   
find_sequence(<gray>name, file_types, folders</gray>)   <gray># find frame_0, frame_1, frame_2 and so on</gray>
import_all_classes(<gray>path=application.asset_folder, debug=False</gray>)   
print_on_screen(<gray>text, position=window.top_left, origin=(-.5,.5), scale=1, duration=1</gray>)   

<div class="example"><purple>def</purple> test_func(item, x=None, <olive>y</olive>=None):
    <blue>print</blue>(item, x, y)

test_func(<green>'test'</green>)
invoke(test_func, <green>'test'</green>, dela<olive>y</olive>=.<yellow>1</yellow>)
invoke(test_func, <green>'test1'</green>, <yellow>1</yellow>, <yellow>2</yellow>, dela<olive>y</olive>=.<yellow>2</yellow>)
invoke(test_func, <green>'test2'</green>, x=<yellow>1</yellow>, <olive>y</olive>=<yellow>2</yellow>, dela<olive>y</olive>=.<yellow>3</yellow>)

<purple>def</purple> input(key):
    <purple>if</purple> key == <green>'space'</green>:
        print_on_screen(<green>'debug message'</green>, <olive>position</olive>=(<yellow>0</yellow>,<yellow>0</yellow>), <olive>origin</olive>=(<yellow>0</yellow>,<yellow>0</yellow>), <olive>scale</olive>=<yellow>2</yellow>)
</div>
</div></div>
<div id="Vec2"><div id="Vec2" style="color:hsl(349.0, 89%, 28%); font-size:1.75em; font-weight:normal;">Vec2<gray>(PandaVec2)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/vec2.py"><gray>ursina.vec2</gray></a><br><br><params class="params">Vec2(**kwargs)</params>

x
y


<div class="example">a = <purple><b>Vec2</b></purple>(<yellow>1</yellow>,<yellow>1</yellow>)
<blue>print</blue>(a)
<blue>print</blue>(round(a))
</div>
</div></div>
<div id="Vec3"><div id="Vec3" style="color:hsl(349.0, 89%, 28%); font-size:1.75em; font-weight:normal;">Vec3<gray>(PandaVec3)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/vec3.py"><gray>ursina.vec3</gray></a><br><br><params class="params">Vec3(**kwargs)</params>

x
y
z
xy
xz
yz


<div class="example">a = <purple><b>Vec3</b></purple>(<yellow>1</yellow>,<yellow>0</yellow>,<yellow>0</yellow>) * <yellow>2</yellow>
a = <purple><b>Vec3</b></purple>(<yellow>1</yellow>,<yellow>0</yellow>,<yellow>1</yellow>) * <purple><b>Vec3</b></purple>(<yellow>2</yellow>,<yellow>1</yellow>,<yellow>2</yellow>)
b = <purple><b>Vec3</b></purple>(<yellow>1</yellow>.<yellow>2</yellow><yellow>5</yellow><yellow>2</yellow><yellow>3</yellow><yellow>5</yellow><yellow>2</yellow><yellow>3</yellow><yellow>2</yellow><yellow>4</yellow>,<yellow>0</yellow>,<yellow>1</yellow>)
b += <purple><b>Vec3</b></purple>(<yellow>0</yellow>,<yellow>1</yellow>)
</div>
</div></div>
<div id="Animation"><div id="Animation" style="color:hsl(320.0, 89%, 28%); font-size:1.75em; font-weight:normal;">Animation<gray>(Sprite)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/prefabs/animation.py"><gray>ursina.prefabs.animation</gray></a><br><br><params class="params">Animation(name, fps=12, loop=True, autoplay=True, frame_times=None, **kwargs)</params>

sequence<gray> = Sequence(loop=loop, auto_destroy=False)</gray> 
frame_times<gray> = frame_times</gray> 
is_playing<gray> = False</gray> 
autoplay<gray> = autoplay</gray> 
duration            <gray># get the duration of the animation. you can't set it. to do so, change the fps instead.</gray>

start()   
pause()   
resume()   
finish()   

<div class="example"><green><green>''</green>'
Loads an image sequence as a frame animation.
So if you have some frames named image_000.png, image_001.png, image_002.png and so on,
you can load it like this: <b>Animation</b>(<green>'image'</green>)

You can also load a .gif by including the file type: <b>Animation</b>(<green>'image.gif'</green>)
<green>''</green>'</green>

<purple><b>Animation</b></purple>(<green>'ursina_wink'</green>)
</div>
</div></div>
<div id="Animator"><div id="Animator" style="color:hsl(320.0, 89%, 28%); font-size:1.75em; font-weight:normal;">Animator<gray>()</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/prefabs/animator.py"><gray>ursina.prefabs.animator</gray></a><br><br><params class="params">Animator(animations=None, start_state='')</params>

animations<gray> = animations    # dict</gray> 
start_state<gray> = start_state</gray> 
state<gray> = start_state</gray> 


<div class="example">anim = Animation(<green>'ursina_wink'</green>, loop=True, autopla<olive>y</olive>=False)
a = <purple><b>Animator</b></purple>(
    animations = {
        <green>'lol'</green> : <olive>Entity</olive>(<olive>model</olive>=<green>'cube'</green>, <olive>color</olive>=color.red),
        <green>'yo'</green> : <olive>Entity</olive>(<olive>model</olive>=<green>'cube'</green>, <olive>color</olive>=color.green, x=<yellow>1</yellow>),
        <green>'help'</green> : anim,
    }
)
a.state = <green>'yo'</green>

Text(<green>'press &ltred&gt1&ltdefault&gt, &ltgreen&gt2&ltdefault&gt or &ltviolet&gt3&ltdefault&gt to toggle different animator states'</green>, <olive>origin</olive>=(<yellow>0</yellow>,-.<yellow>5</yellow>), <olive>y</olive>=-.<yellow>4</yellow>)

<purple>def</purple> input(key):
    <purple>if</purple> key == <green>'1'</green>:
        a.state = <green>'lol'</green>
    <purple>if</purple> key == <green>'2'</green>:
        a.state = <green>'yo'</green>
    <purple>if</purple> key == <green>'3'</green>:
        a.state = <green>'help'</green>
        <blue>print</blue>(anim.enabled)
</div>
</div></div>
<div id="ButtonGroup"><div id="ButtonGroup" style="color:hsl(320.0, 89%, 28%); font-size:1.75em; font-weight:normal;">ButtonGroup<gray>(<a style="color: gray;" href="#Entity">Entity</a>)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/prefabs/button_group.py"><gray>ursina.prefabs.button_group</gray></a><br><br><params class="params">ButtonGroup(options=None, default='', min_selection=0, max_selection=1, **kwargs)</params>

deselected_color<gray> = Button.color</gray> 
selected_color<gray> = color.azure</gray> 
min_selection<gray> = min_selection</gray> 
max_selection<gray> = max(min_selection, max_selection)</gray> 
buttons<gray> = list()</gray> 
selected<gray> = list()</gray> 
options<gray> = options</gray> 
parent<gray> = camera.ui</gray> 
scale<gray> = Text.size * 2</gray> 
value

layout()   
input(<gray>key</gray>)   
select(<gray>b</gray>)   
on_value_changed()   

<div class="example">gender_selection = <purple><b>ButtonGroup</b></purple>((<green>'man'</green>, <green>'woman'</green>, <green>'other'</green>))
on_off_switch = <purple><b>ButtonGroup</b></purple>((<green>'off'</green>, <green><green>'on'</green></green>), min_selection=<yellow>1</yellow>, <olive>y</olive>=-.<yellow>1</yellow>, default=<green><green>'on'</green></green>, selected_<olive>color</olive>=color.red)

<purple>def</purple> on_value_changed():
    <blue>print</blue>(<green>'set gender:'</green>, gender_selection.value)
gender_selection.on_value_changed = on_value_changed

<purple>def</purple> on_value_changed():
    <blue>print</blue>(<green>'turn:'</green>, on_off_switch.value)
on_off_switch.on_value_changed = on_value_changed

window.color = color._<yellow>3</yellow><yellow>2</yellow>
</div>
</div></div>
<div id="ButtonList"><div id="ButtonList" style="color:hsl(320.0, 89%, 28%); font-size:1.75em; font-weight:normal;">ButtonList<gray>(<a style="color: gray;" href="#Entity">Entity</a>)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/prefabs/button_list.py"><gray>ursina.prefabs.button_list</gray></a><br><br><params class="params">ButtonList(button_dict, button_height=1.365, fit_height=True, width=.5, **kwargs)</params>

fit_height<gray> = fit_height</gray> 
button_height<gray> = button_height</gray> 
text_entity<gray> = Text(parent=self, origin=(-.5,.5), text='empty', world_scale=20, z=-.1, x=.01)</gray> 
button_height<gray> = self.text_entity.height</gray> 
button_dict<gray> = button_dict</gray> 
highlight<gray> = Entity(parent=self, model='quad', color=color.white33, scale=(1,self.button_height), origin=(-.5,.5), z=-.01, add_to_scene_entities=False)</gray> 
selection_marker<gray> = Entity(parent=self, model='quad', color=color.azure, scale=(1,self.button_height), origin=(-.5,.5), z=-.02, enabled=False, add_to_scene_entities=False)</gray> 

input(<gray>key</gray>)   
update()   
on_disable()   

<div class="example">default = Func(print, <green>'not yet implemented'</green>)

<purple>def</purple> test(a=<yellow>1</yellow>, b=<yellow>2</yellow>):
    <blue>print</blue>(<green>'------:'</green>, a, b)

button_dict = {
    <green>'one'</green> :     None,
    <green>'two'</green> :     default,
    <green>'tree'</green> :    Func(test, <yellow>3</yellow>, <yellow>4</yellow>),
    <green>'four'</green> :    Func(test, b=<yellow>3</yellow>, a=<yellow>4</yellow>),
}
<purple>for</purple> i in <blue>range</blue>(<yellow>6</yellow>, <yellow>1</yellow><yellow>2</yellow>):
    button_dict[f<green>'button {i}'</green>] = Func(print, i)

bl = <purple><b>ButtonList</b></purple>(button_dict, fit_height=True)
bl.on_click = Func(setattr, bl, <green>'enabled'</green>, False)
</div>
</div></div>
<div id="Cursor"><div id="Cursor" style="color:hsl(320.0, 89%, 28%); font-size:1.75em; font-weight:normal;">Cursor<gray>(<a style="color: gray;" href="#Entity">Entity</a>)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/prefabs/cursor.py"><gray>ursina.prefabs.cursor</gray></a><br><br><params class="params">Cursor(**kwargs)</params>

parent<gray> = camera.ui</gray> 
texture<gray> = 'cursor'</gray> 
model<gray> = 'quad'</gray> 
color<gray> = color.light_gray</gray> 
render_queue<gray> = 1</gray> 

update()   

<div class="example">Button(<green>'button'</green>).fit_to_text()
Panel()
camera.orthographic = True
camera.fov = <yellow>1</yellow><yellow>0</yellow><yellow>0</yellow>
e = <olive>Entity</olive>(<olive>model</olive>=<green>'cube'</green>)
mouse._mouse_watcher.setGeometry(e.model.node())
mouse.visible = False
</div>
</div></div>
<div id="DebugMenu"><div id="DebugMenu" style="color:hsl(320.0, 89%, 28%); font-size:1.75em; font-weight:normal;">DebugMenu<gray>(<a style="color: gray;" href="#Draggable">Draggable</a>)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/prefabs/debug_menu.py"><gray>ursina.prefabs.debug_menu</gray></a><br><br><params class="params">DebugMenu(target, **kwargs)</params>

target<gray> = target</gray> 
scale<gray> = (.2, .025)</gray> 
text<gray> = '&ltorange&gt' + target.__class__.__name__</gray> 

draw_functions()   

<div class="example"><purple><b>DebugMenu</b></purple>(Audio(<green>'night_sky'</green>))
</div>
</div></div>
<div id="Draggable"><div id="Draggable" style="color:hsl(320.0, 89%, 28%); font-size:1.75em; font-weight:normal;">Draggable<gray>(<a style="color: gray;" href="#Button">Button</a>)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/prefabs/draggable.py"><gray>ursina.prefabs.draggable</gray></a><br><br><params class="params">Draggable(**kwargs)</params>

require_key<gray> = None</gray> 
dragging<gray> = False</gray> 
delta_drag<gray> = 0</gray> 
start_pos<gray> = self.world_position</gray> 
start_offset<gray> = (0,0,0)</gray> 
step<gray> = (0,0,0)</gray> 
plane_direction<gray> = (0,0,1)</gray> 
lock_x<gray> = False</gray> 
lock_y<gray> = False</gray> 
lock_z<gray> = False</gray> 
min_x, self.min_y, self.min_z<gray> = -inf, -inf, -inf</gray> 
max_x, self.max_y, self.max_z<gray> = inf, inf, inf</gray> 

input(<gray>key</gray>)   
start_dragging()   
stop_dragging()   
update()   

<div class="example"><olive>Entity</olive>(<olive>model</olive>=<green>'plane'</green>, <olive>scale</olive>=<yellow>8</yellow>, <olive>texture</olive>=<green>'white_cube'</green>, <olive>texture_scale</olive>=(<yellow>8</yellow>,<yellow>8</yellow>))
draggable_button = <purple><b>Draggable</b></purple>(<olive>scale</olive>=.<yellow>1</yellow>, <olive>text</olive>=<green>'drag me'</green>, <olive>position</olive>=(-.<yellow>5</yellow>, <yellow>0</yellow>))
world_space_draggable = <purple><b>Draggable</b></purple>(<olive>parent</olive>=scene, <olive>model</olive>=<green>'cube'</green>, <olive>color</olive>=color.azure, plane_direction=(<yellow>0</yellow>,<yellow>1</yellow>,<yellow>0</yellow>))

EditorCamera(<olive>rotation</olive>=(<yellow>3</yellow><yellow>0</yellow>,<yellow>1</yellow><yellow>0</yellow>,<yellow>0</yellow>))
world_space_draggable.drop = Func(print, <green>'dropped cube'</green>)
</div>
</div></div>
<div id="DropdownMenuButton"><div id="DropdownMenuButton" style="color:hsl(320.0, 89%, 28%); font-size:1.75em; font-weight:normal;">DropdownMenuButton<gray>(<a style="color: gray;" href="#Button">Button</a>)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/prefabs/dropdown_menu.py"><gray>ursina.prefabs.dropdown_menu</gray></a><br><br><params class="params">DropdownMenuButton(text='', **kwargs)</params>



<div class="example"><purple>from</purple> ursina.prefabs.dropdown_menu <purple>import</purple> DropdownMenu, DropdownMenuButton

DropdownMenu(<green>'File'</green>, buttons=(
    <purple><b>DropdownMenuButton</b></purple>(<green>'New'</green>),
    <purple><b>DropdownMenuButton</b></purple>(<green>'Open'</green>),
    DropdownMenu(<green>'Reopen Project'</green>, buttons=(
        <purple><b>DropdownMenuButton</b></purple>(<green>'Project 1'</green>),
        <purple><b>DropdownMenuButton</b></purple>(<green>'Project 2'</green>),
        )),
    <purple><b>DropdownMenuButton</b></purple>(<green>'Save'</green>),
    DropdownMenu(<green>'Options'</green>, buttons=(
        <purple><b>DropdownMenuButton</b></purple>(<green>'Option a'</green>),
        <purple><b>DropdownMenuButton</b></purple>(<green>'Option b'</green>),
        )),
    <purple><b>DropdownMenuButton</b></purple>(<green>'Exit'</green>),
    ))
</div>
</div></div>
<div id="DropdownMenu"><div id="DropdownMenu" style="color:hsl(320.0, 89%, 28%); font-size:1.75em; font-weight:normal;">DropdownMenu<gray>(DropdownMenuButton)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/prefabs/dropdown_menu.py"><gray>ursina.prefabs.dropdown_menu</gray></a><br><br><params class="params">DropdownMenu(text='', buttons=list(), **kwargs)</params>

position<gray> = window.top_left</gray> 
buttons<gray> = buttons</gray> 
arrow_symbol<gray> = Text(world_parent=self, text='&gt', origin=(.5,.5), position=(.95, 0), color=color.gray)</gray> 

open()   
close()   
on_mouse_enter()   
input(<gray>key</gray>)   
update()   

<div class="example"><purple>from</purple> ursina.prefabs.dropdown_menu <purple>import</purple> DropdownMenu, DropdownMenuButton

<purple><b>DropdownMenu</b></purple>(<green>'File'</green>, buttons=(
    DropdownMenuButton(<green>'New'</green>),
    DropdownMenuButton(<green>'Open'</green>),
    <purple><b>DropdownMenu</b></purple>(<green>'Reopen Project'</green>, buttons=(
        DropdownMenuButton(<green>'Project 1'</green>),
        DropdownMenuButton(<green>'Project 2'</green>),
        )),
    DropdownMenuButton(<green>'Save'</green>),
    <purple><b>DropdownMenu</b></purple>(<green>'Options'</green>, buttons=(
        DropdownMenuButton(<green>'Option a'</green>),
        DropdownMenuButton(<green>'Option b'</green>),
        )),
    DropdownMenuButton(<green>'Exit'</green>),
    ))
</div>
</div></div>
<div id="EditorCamera"><div id="EditorCamera" style="color:hsl(320.0, 89%, 28%); font-size:1.75em; font-weight:normal;">EditorCamera<gray>(<a style="color: gray;" href="#Entity">Entity</a>)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/prefabs/editor_camera.py"><gray>ursina.prefabs.editor_camera</gray></a><br><br><params class="params">EditorCamera(**kwargs)</params>

gizmo<gray> = Entity(parent=self, model='sphere', color=color.orange, scale=.025, add_to_scene_entities=False)</gray> 
rotation_speed<gray> = 200</gray> 
pan_speed<gray> = Vec2(5, 5)</gray> 
move_speed<gray> = 10</gray> 
zoom_speed<gray> = .75</gray> 
rotate_around_mouse_hit<gray> = False</gray> 
start_position<gray> = self.position</gray> 
perspective_fov<gray> = camera.fov</gray> 
orthographic_fov<gray> = camera.fov</gray> 
on_destroy<gray> = self.on_disable</gray> 
hotkeys<gray> = {'toggle_orthographic':'p', 'center':'f'}</gray> 

on_enable()   
on_disable()   
input(<gray>key</gray>)   
update()   

<div class="example"><green><green>''</green>'
Simple camera for debugging.
Hold right click and move the mouse to rotate around point.
<green>''</green>'</green>

sky = Sky()
e = <olive>Entity</olive>(<olive>model</olive>=<green>'cube'</green>, <olive>color</olive>=color.white, <olive>collider</olive>=<green>'box'</green>)
e.model.colorize()

<purple>from</purple> ursina.prefabs.first_person_controller <purple>import</purple> FirstPersonController

ground = <olive>Entity</olive>(<olive>model</olive>=<green>'plane'</green>, <olive>scale</olive>=<yellow>3</yellow><yellow>2</yellow>, <olive>texture</olive>=<green>'white_cube'</green>, <olive>texture_scale</olive>=(<yellow>3</yellow><yellow>2</yellow>,<yellow>3</yellow><yellow>2</yellow>), <olive>collider</olive>=<green>'box'</green>)
box = <olive>Entity</olive>(<olive>model</olive>=<green>'cube'</green>, <olive>collider</olive>=<green>'box'</green>, <olive>texture</olive>=<green>'white_cube'</green>, <olive>scale</olive>=(<yellow>1</yellow><yellow>0</yellow>,<yellow>2</yellow>,<yellow>2</yellow>), <olive>position</olive>=(<yellow>2</yellow>,<yellow>1</yellow>,<yellow>5</yellow>), <olive>color</olive>=color.light_gray)
ec = <purple><b>EditorCamera</b></purple>(rotation_smoothing=<yellow>2</yellow>, <olive>enabled</olive>=False, <olive>rotation</olive>=(<yellow>3</yellow><yellow>0</yellow>,<yellow>3</yellow><yellow>0</yellow>,<yellow>0</yellow>))
player = FirstPersonController()

rotation_info = Text(<olive>position</olive>=window.top_left)

<purple>def</purple> update():
    rotation_info.text = str(int(ec.rotation_y)) + <green>'\n'</green> + str(int(ec.rotation_x))


<purple>def</purple> input(key):
    if key == <green>'tab'</green>:    <gray># press tab to toggle edit/play mode</gray>
        ec.enabled = <purple>not</purple> ec.enabled
        player.enabled = <purple>not</purple> player.enabled
</div>
</div></div>
<div id="ExitButton"><div id="ExitButton" style="color:hsl(320.0, 89%, 28%); font-size:1.75em; font-weight:normal;">ExitButton<gray>(<a style="color: gray;" href="#Button">Button</a>)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/prefabs/exit_button.py"><gray>ursina.prefabs.exit_button</gray></a><br><br><params class="params">ExitButton(**kwargs)</params>


on_click()   
input(<gray>key</gray>)   

<div class="example"><green><green>''</green>'
This is the button in the upper right corner.
You can click on it or press Shift+Q to close the program.
To disable it, set window.exit_button.enabled to False
<green>''</green>'</green>
</div>
</div></div>
<div id="FileButton"><div id="FileButton" style="color:hsl(320.0, 89%, 28%); font-size:1.75em; font-weight:normal;">FileButton<gray>(<a style="color: gray;" href="#Button">Button</a>)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/prefabs/file_browser.py"><gray>ursina.prefabs.file_browser</gray></a><br><br><params class="params">FileButton(load_menu, **kwargs)</params>

load_menu<gray> = load_menu</gray> 
selected

on_click()   
on_double_click()   

<div class="example">fb = FileBrowser(file_types=(<green>'.*'</green>), <olive>enabled</olive>=True)

<purple>def</purple> on_submit(paths):
    <blue>print</blue>(<green>'--------'</green>, paths)
    <purple>for</purple> p in paths:
        <blue>print</blue>(<green>'---'</green>, p)

fb.on_submit = on_submit
</div>
</div></div>
<div id="FileBrowser"><div id="FileBrowser" style="color:hsl(320.0, 89%, 28%); font-size:1.75em; font-weight:normal;">FileBrowser<gray>(<a style="color: gray;" href="#Entity">Entity</a>)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/prefabs/file_browser.py"><gray>ursina.prefabs.file_browser</gray></a><br><br><params class="params">FileBrowser(**kwargs)</params>

file_types<gray> = ['.*', ]</gray> 
start_path<gray> = Path('.').resolve()</gray> 
return_files<gray> = True</gray> 
return_folders<gray> = False</gray> 
selection_limit<gray> = 1</gray> 
max_buttons<gray> = 24</gray> 
title_bar<gray> = Button(parent=self, scale=(.9,.035), text='&ltgray&gtOpen', color=color.dark_gray, collision=False)</gray> 
address_bar<gray> = Button(parent=self, scale=(.8,.035), text='//', text_origin=(-.5,0), y=-.05, highlight_color=color.black)</gray> 
folder_up_button<gray> = Button(parent=self, scale=(.035,.035), texture='arrow_down', rotation_z=180, position=(-.42,-.05), color=color.white, highlight_color=color.azure, on_click=self.folder_up)</gray> 
button_parent<gray> = Entity(parent=self)</gray> 
back_panel<gray> = Entity(parent=self, model='quad', collider='box', origin_y=.5, scale=(.9,(self.max_buttons*.025)+.19), color=color._32, z=.1)</gray> 
bg<gray> = Button(parent=self, z=1, scale=(999,999), color=color.black66, highlight_color=color.black66, pressed_color=color.black66)</gray> 
cancel_button<gray> = Button(parent=self, scale=(.875*.24, .05), y=(-self.max_buttons*.025)-.15, origin_x=-.5, x=-.875/2, text='Cancel', on_click=self.close)</gray> 
open_button<gray> = Button(parent=self, scale=(.875*.74, .05), y=(-self.max_buttons*.025)-.15, origin_x=.5, x=.875/2, text='Open', color=color.dark_gray, on_click=self.open)</gray> 
cancel_button_2<gray> = Button(parent=self.title_bar, model=Circle(), world_scale=self.title_bar.world_scale_y*.75, origin_x=.5, x=.495, z=-.1, text='&ltgray&gtx', on_click=self.close)</gray> 
can_scroll_up_indicator<gray> = Entity(parent=self, model='quad', texture='arrow_down', rotation_z=180, scale=(.05,.05), y=-.0765, z=-.1, color=color.dark_gray, enabled=False, add_to_scene_entities=False)</gray> 
can_scroll_down_indicator<gray> = Entity(parent=self, model='quad', texture='arrow_down', scale=(.05,.05), y=(-self.max_buttons*.025)-.104, z=-.1, color=color.dark_gray, enabled=False, add_to_scene_entities=False)</gray> 
scroll
path
selection

input(<gray>key</gray>)   
on_enable()   
close()   
folder_up()   
open(<gray>path=None</gray>)   

<div class="example">fb = <purple><b>FileBrowser</b></purple>(file_types=(<green>'.*'</green>), <olive>enabled</olive>=True)

<purple>def</purple> on_submit(paths):
    <blue>print</blue>(<green>'--------'</green>, paths)
    <purple>for</purple> p in paths:
        <blue>print</blue>(<green>'---'</green>, p)

fb.on_submit = on_submit
</div>
</div></div>
<div id="FileBrowserSave"><div id="FileBrowserSave" style="color:hsl(320.0, 89%, 28%); font-size:1.75em; font-weight:normal;">FileBrowserSave<gray>(FileBrowser)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/prefabs/file_browser_save.py"><gray>ursina.prefabs.file_browser_save</gray></a><br><br><params class="params">FileBrowserSave(**kwargs)</params>

save_button<gray> = self.open_button</gray> 
file_name_field<gray> = InputField(
        parent</gray> 
file_type<gray> = '' # to save as</gray> 
data<gray> = ''</gray> 
last_saved_file<gray> = None     # gets set when you save a file</gray> 
overwrite_prompt<gray> = WindowPanel(
        content=(
            Text('Overwrite?'),
            Button('Yes', color=color.azure, on_click=self.save),
            Button('Cancel')
        ),
        z=-1,
        popup=True,
        enabled=False)</gray> 

save()   

<div class="example"><purple>from</purple> ursina.prefabs.file_browser_save <purple>import</purple> FileBrowserSave

wp = <purple><b>FileBrowserSave</b></purple>(file_type = <green>'.oto'</green>)


<purple>import</purple> json
save_data = {<green>'level'</green>: <yellow>4</yellow>, <green>'name'</green>:<green>'Link'</green>}
wp.data = json.dumps(save_data)
</div>
</div></div>
<div id="FirstPersonController"><div id="FirstPersonController" style="color:hsl(320.0, 89%, 28%); font-size:1.75em; font-weight:normal;">FirstPersonController<gray>(<a style="color: gray;" href="#Entity">Entity</a>)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/prefabs/first_person_controller.py"><gray>ursina.prefabs.first_person_controller</gray></a><br><br><params class="params">FirstPersonController(**kwargs)</params>

speed<gray> = 5</gray> 
origin_y<gray> = -.5</gray> 
camera_pivot<gray> = Entity(parent=self, y=2)</gray> 
cursor<gray> = Entity(parent=camera.ui, model='quad', color=color.pink, scale=.008, rotation_z=45)</gray> 
mouse_sensitivity<gray> = Vec2(40, 40)</gray> 
gravity<gray> = 1</gray> 
grounded<gray> = False</gray> 
jump_height<gray> = 2</gray> 
jump_duration<gray> = .5</gray> 
jumping<gray> = False</gray> 
air_time<gray> = 0</gray> 

update()   
input(<gray>key</gray>)   
jump()   
start_fall()   
land()   
on_enable()   
on_disable()   

<div class="example"><purple>from</purple> ursina.prefabs.first_person_controller <purple>import</purple> FirstPersonController
ground = <olive>Entity</olive>(<olive>model</olive>=<green>'plane'</green>, <olive>scale</olive>=(<yellow>1</yellow><yellow>0</yellow><yellow>0</yellow>,<yellow>1</yellow>,<yellow>1</yellow><yellow>0</yellow><yellow>0</yellow>), <olive>color</olive>=color.yellow.tint(-.<yellow>2</yellow>), <olive>texture</olive>=<green>'white_cube'</green>, <olive>texture_scale</olive>=(<yellow>1</yellow><yellow>0</yellow><yellow>0</yellow>,<yellow>1</yellow><yellow>0</yellow><yellow>0</yellow>), <olive>collider</olive>=<green>'box'</green>)
e = <olive>Entity</olive>(<olive>model</olive>=<green>'cube'</green>, <olive>scale</olive>=(<yellow>1</yellow>,<yellow>5</yellow>,<yellow>1</yellow><yellow>0</yellow>), x=<yellow>2</yellow>, <olive>y</olive>=.<yellow>0</yellow><yellow>1</yellow>, rotation_<olive>y</olive>=<yellow>4</yellow><yellow>5</yellow>, <olive>collider</olive>=<green>'box'</green>, <olive>texture</olive>=<green>'white_cube'</green>)
e.texture_scale = (e.scale_z, e.scale_y)
e = <olive>Entity</olive>(<olive>model</olive>=<green>'cube'</green>, <olive>scale</olive>=(<yellow>1</yellow>,<yellow>5</yellow>,<yellow>1</yellow><yellow>0</yellow>), x=-<yellow>2</yellow>, <olive>y</olive>=.<yellow>0</yellow><yellow>1</yellow>, <olive>collider</olive>=<green>'box'</green>, <olive>texture</olive>=<green>'white_cube'</green>)
e.texture_scale = (e.scale_z, e.scale_y)

player = <purple><b>FirstPersonController</b></purple>(<olive>model</olive>=<green>'cube'</green>, <olive>y</olive>=<yellow>1</yellow>, origin_<olive>y</olive>=-.<yellow>5</yellow>)
player.gun = None

gun = Button(<olive>parent</olive>=scene, <olive>model</olive>=<green>'cube'</green>, <olive>color</olive>=color.blue, origin_<olive>y</olive>=-.<yellow>5</yellow>, <olive>position</olive>=(<yellow>3</yellow>,<yellow>0</yellow>,<yellow>3</yellow>), <olive>collider</olive>=<green>'box'</green>)
gun.on_click = Sequence(Func(setattr, gun, <green>'parent'</green>, camera), Func(setattr, player, <green>'gun'</green>, gun))

gun_<yellow>2</yellow> = duplicate(gun, <olive>z</olive>=<yellow>7</yellow>, x=<yellow>8</yellow>)
slope = <olive>Entity</olive>(<olive>model</olive>=<green>'cube'</green>, <olive>collider</olive>=<green>'box'</green>, <olive>position</olive>=(<yellow>0</yellow>,<yellow>0</yellow>,<yellow>8</yellow>), <olive>scale</olive>=<yellow>6</yellow>, <olive>rotation</olive>=(<yellow>4</yellow><yellow>5</yellow>,<yellow>0</yellow>,<yellow>0</yellow>), <olive>texture</olive>=<green>'brick'</green>, <olive>texture_scale</olive>=(<yellow>8</yellow>,<yellow>8</yellow>))
slope = <olive>Entity</olive>(<olive>model</olive>=<green>'cube'</green>, <olive>collider</olive>=<green>'box'</green>, <olive>position</olive>=(<yellow>5</yellow>,<yellow>0</yellow>,<yellow>1</yellow><yellow>0</yellow>), <olive>scale</olive>=<yellow>6</yellow>, <olive>rotation</olive>=(<yellow>8</yellow><yellow>0</yellow>,<yellow>0</yellow>,<yellow>0</yellow>), <olive>texture</olive>=<green>'brick'</green>, <olive>texture_scale</olive>=(<yellow>8</yellow>,<yellow>8</yellow>))

<purple>def</purple> input(key):
    <purple>if</purple> key == <green>'left mouse down'</green> and player.gun:
        gun.blink(color.orange)
        bullet = <olive>Entity</olive>(<olive>parent</olive>=gun, <olive>model</olive>=<green>'cube'</green>, <olive>scale</olive>=.<yellow>1</yellow>, <olive>color</olive>=color.black)
        bullet.world_parent = scene
        bullet.animate_position(bullet.position+(bullet.forward*<yellow>5</yellow><yellow>0</yellow>), <olive>curve</olive>=curve.linear, duration=<yellow>1</yellow>)
        destroy(bullet, dela<olive>y</olive>=<yellow>1</yellow>)
</div>
</div></div>
<div id="FrameAnimation3d"><div id="FrameAnimation3d" style="color:hsl(320.0, 89%, 28%); font-size:1.75em; font-weight:normal;">FrameAnimation3d<gray>(<a style="color: gray;" href="#Entity">Entity</a>)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/prefabs/frame_animation_3d.py"><gray>ursina.prefabs.frame_animation_3d</gray></a><br><br><params class="params">FrameAnimation3d(name, fps=12, loop=True, autoplay=True, frame_times=None, **kwargs)</params>

frames<gray> = [Entity(parent=self, model=e.stem, enabled=False, add_to_scene_entities=False) for e in model_names]</gray> 
sequence<gray> = Sequence(loop=loop, auto_destroy=False)</gray> 
is_playing<gray> = False</gray> 
autoplay<gray> = autoplay</gray> 
duration

start()   
pause()   
resume()   
finish()   

<div class="example">application.asset_folder = application.asset_folder.parent.parent / <green>'samples'</green>

<green><green>''</green>'
Loads an obj sequence as a frame animation.
So if you have some frames named run_cycle_000.obj, run_cycle_001.obj, run_cycle_002.obj and so on,
you can load it like this: FrameAnimation3d(<green>'run_cycle_'</green>)
<green>''</green>'</green>

FrameAnimation<yellow>3</yellow>d(<green>'blob_animation_'</green>)
</div>
</div></div>
<div id="GridEditor"><div id="GridEditor" style="color:hsl(320.0, 89%, 28%); font-size:1.75em; font-weight:normal;">GridEditor<gray>(<a style="color: gray;" href="#Entity">Entity</a>)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/prefabs/grid_editor.py"><gray>ursina.prefabs.grid_editor</gray></a><br><br><params class="params">GridEditor(size=(32,32), palette=(' ', '#', '|', 'o'), **kwargs)</params>

w, self.h<gray> = int(size[0]), int(size[1])</gray> 
brush_size<gray> = 1</gray> 
auto_render<gray> = True</gray> 
cursor<gray> = Entity(parent=self, model=Quad(segments=0, mode='line'), origin=(-.5,-.5), scale=(1/self.w, 1/self.h), color=color.color(0,1,1,.5), z=-.1)</gray> 
selected_char<gray> = palette[1]</gray> 
palette<gray> = palette</gray> 
prev_draw<gray> = None</gray> 
start_pos<gray> = (0,0)</gray> 
outline<gray> = Entity(parent=self, model=Quad(segments=0, mode='line', thickness=1), color=color.cyan, z=.01, origin=(-.5,-.5))</gray> 
undo_cache<gray> = list()</gray> 
undo_index<gray> = 0</gray> 
help_text<gray> = Text(
        text=dedent('''
            left mouse:    draw
            control(hold): draw lines
            alt(hold):     select character
            ctrl + z:      undo
            ctrl + y:      redo
        '''),
        position=window.top_left,
        scale=.75
        )</gray> 
edit_mode<gray> = True</gray> 

update()   
draw(<gray>x, y</gray>)   
input(<gray>key</gray>)   
record_undo()   
floodfill(<gray>matrix, x, y, first=True</gray>)   

<div class="example"><green><green>''</green>'
pixel editor example, it's basically a drawing tool.
can be useful for level editors and such
here we create a new texture, but can also give it an exisitng texture to modify.
<green>''</green>'</green>
<purple>from</purple> PIL <purple>import</purple> Image
t = Texture(Image.new(<olive>mode</olive>=<green>'RGBA'</green>, size=(<yellow>3</yellow><yellow>2</yellow>,<yellow>3</yellow><yellow>2</yellow>), <olive>color</olive>=(<yellow>0</yellow>,<yellow>0</yellow>,<yellow>0</yellow>,<yellow>1</yellow>)))
<purple>from</purple> ursina.prefabs.grid_editor <purple>import</purple> PixelEditor

<green><green>''</green>'
same as the pixel editor, but with text.
<green>''</green>'</green>
<purple>from</purple> ursina.prefabs.grid_editor <purple>import</purple> ASCIIEditor
ASCIIEditor()
</div>
</div></div>
<div id="PixelEditor"><div id="PixelEditor" style="color:hsl(320.0, 89%, 28%); font-size:1.75em; font-weight:normal;">PixelEditor<gray>(GridEditor)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/prefabs/grid_editor.py"><gray>ursina.prefabs.grid_editor</gray></a><br><br><params class="params">PixelEditor(texture, palette=(color.black, color.white, color.light_gray, color.gray, color.red, color.orange, color.yellow, color.lime, color.green, color.turquoise, color.cyan, color.azure, color.blue, color.violet, color.magenta, color.pink), **kwargs)</params>

grid<gray> = [[texture.get_pixel(x,y) for y in range(texture.height)] for x in range(texture.width)]</gray> 

render()   
save()   

<div class="example"><green><green>''</green>'
pixel editor example, it's basically a drawing tool.
can be useful for level editors and such
here we create a new texture, but can also give it an exisitng texture to modify.
<green>''</green>'</green>
<purple>from</purple> PIL <purple>import</purple> Image
t = Texture(Image.new(<olive>mode</olive>=<green>'RGBA'</green>, size=(<yellow>3</yellow><yellow>2</yellow>,<yellow>3</yellow><yellow>2</yellow>), <olive>color</olive>=(<yellow>0</yellow>,<yellow>0</yellow>,<yellow>0</yellow>,<yellow>1</yellow>)))
<purple>from</purple> ursina.prefabs.grid_editor <purple>import</purple> PixelEditor

<green><green>''</green>'
same as the pixel editor, but with text.
<green>''</green>'</green>
<purple>from</purple> ursina.prefabs.grid_editor <purple>import</purple> ASCIIEditor
ASCIIEditor()
</div>
</div></div>
<div id="ASCIIEditor"><div id="ASCIIEditor" style="color:hsl(320.0, 89%, 28%); font-size:1.75em; font-weight:normal;">ASCIIEditor<gray>(GridEditor)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/prefabs/grid_editor.py"><gray>ursina.prefabs.grid_editor</gray></a><br><br><params class="params">ASCIIEditor(size=(61,28), palette=(' ', '#', '|', 'A', '/', '\\', 'o', '_', '-', 'i', 'M', '.'), font='VeraMono.ttf', color=color.black, line_height=1.1, **kwargs)</params>

text_entity<gray> = Text(text=' '*size[0], position=(-.45,-.45,-2), line_height=line_height, origin=(-.5,-.5), font=font)</gray> 
scale<gray> = (self.text_entity.width, self.h*Text.size*self.text_entity.line_height)</gray> 

render()   
input(<gray>key</gray>)   

<div class="example"><green><green>''</green>'
pixel editor example, it's basically a drawing tool.
can be useful for level editors and such
here we create a new texture, but can also give it an exisitng texture to modify.
<green>''</green>'</green>
<purple>from</purple> PIL <purple>import</purple> Image
t = Texture(Image.new(<olive>mode</olive>=<green>'RGBA'</green>, size=(<yellow>3</yellow><yellow>2</yellow>,<yellow>3</yellow><yellow>2</yellow>), <olive>color</olive>=(<yellow>0</yellow>,<yellow>0</yellow>,<yellow>0</yellow>,<yellow>1</yellow>)))
<purple>from</purple> ursina.prefabs.grid_editor <purple>import</purple> PixelEditor

<green><green>''</green>'
same as the pixel editor, but with text.
<green>''</green>'</green>
<purple>from</purple> ursina.prefabs.grid_editor <purple>import</purple> ASCIIEditor
<purple><b>ASCIIEditor</b></purple>()
</div>
</div></div>
<div id="HealthBar"><div id="HealthBar" style="color:hsl(320.0, 89%, 28%); font-size:1.75em; font-weight:normal;">HealthBar<gray>(<a style="color: gray;" href="#Button">Button</a>)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/prefabs/health_bar.py"><gray>ursina.prefabs.health_bar</gray></a><br><br><params class="params">HealthBar(max_value=100, show_text=True, show_lines=False, **kwargs)</params>

bar<gray> = Entity(parent=self, model='quad', origin=self.origin, z=-.01, color=color.red.tint(-.2), ignore=True)</gray> 
animation_duration<gray> = .1</gray> 
lines<gray> = Entity(parent=self.bar, origin=self.origin, y=-1, color=color.black33, ignore=True)</gray> 
roundness<gray> = .25</gray> 
max_value<gray> = max_value</gray> 
clamp<gray> = True</gray> 
show_lines<gray> = show_lines</gray> 
show_text<gray> = show_text</gray> 
scale_x<gray> = self.scale_x # update rounded corners</gray> 
scale_y<gray> = self.scale_y # update background's rounded corners</gray> 
value<gray> = self.max_value</gray> 


<div class="example">health_bar_<yellow>1</yellow> = <purple><b>HealthBar</b></purple>(bar_<olive>color</olive>=color.lime.tint(-.<yellow>2</yellow><yellow>5</yellow>), roundness=.<yellow>5</yellow>, value=<yellow>5</yellow><yellow>0</yellow>)

<purple>def</purple> input(key):
    <purple>if</purple> key == <green>'+'</green> or key == <green>'+ hold'</green>:
        health_bar_<yellow>1</yellow>.value += <yellow>1</yellow><yellow>0</yellow>
    <purple>if</purple> key == <green>'-'</green> or key == <green>'- hold'</green>:
        health_bar_<yellow>1</yellow>.value -= <yellow>1</yellow><yellow>0</yellow>
</div>
</div></div>
<div id="HotReloader"><div id="HotReloader" style="color:hsl(320.0, 89%, 28%); font-size:1.75em; font-weight:normal;">HotReloader<gray>(<a style="color: gray;" href="#Entity">Entity</a>)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/prefabs/hot_reloader.py"><gray>ursina.prefabs.hot_reloader</gray></a><br><br><params class="params">HotReloader(path=__file__, **kwargs)</params>

path<gray> = path</gray> 
path<gray> = Path(self.path)</gray> 
realtime_editing<gray> = False   # toggle with f8</gray> 
hotkeys<gray> = {
        'ctrl+r' : self.reload_code,
        'f5'     : self.reload_code,
        'f6'     : self.reload_textures,
        'f7'     : self.reload_models,
        'f8'     : self.reload_shaders,
        # 'f9'     : self.toggle_hotreloading,
        }</gray> 

input(<gray>key</gray>)   
update()   
toggle_hotreloading()   
hot_reload()   
reload_code(<gray>reset_camera=True</gray>)   
reload_textures()   
reload_models()   
reload_shaders()   

<div class="example">application.hot_reloader.path = application.asset_folder.parent.parent / <green>'samples'</green> / <green>'platformer.py'</green>

<green><green>''</green>'
By default you can press F5 to reload the starting script, F6 to reimport textures and F7 to reload models.
<green>''</green>'</green>
</div>
</div></div>
<div id="ContentTypes"><div id="ContentTypes" style="color:hsl(320.0, 89%, 28%); font-size:1.75em; font-weight:normal;">ContentTypes</div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/prefabs/input_field.py"><gray>ursina.prefabs.input_field</gray></a><br><br><params class="params">ContentTypes(path=__file__, **kwargs)</params>



<div class="example">background = <olive>Entity</olive>(<olive>model</olive>=<green>'quad'</green>, <olive>texture</olive>=<green>'pixelscape_combo'</green>, <olive>parent</olive>=camera.ui, <olive>scale</olive>=(camera.aspect_ratio,<yellow>1</yellow>), <olive>color</olive>=color.white)
gradient = <olive>Entity</olive>(<olive>model</olive>=<green>'quad'</green>, <olive>texture</olive>=<green>'vertical_gradient'</green>, <olive>parent</olive>=camera.ui, <olive>scale</olive>=(camera.aspect_ratio,<yellow>1</yellow>), <olive>color</olive>=color.hsv(<yellow>2</yellow><yellow>4</yellow><yellow>0</yellow>,.<yellow>6</yellow>,.<yellow>1</yellow>,.<yellow>7</yellow><yellow>5</yellow>))

username_field = InputField(<olive>y</olive>=-.<yellow>1</yellow><yellow>2</yellow>)
password_field = InputField(<olive>y</olive>=-.<yellow>1</yellow><yellow>8</yellow>, hide_content=True)
username_field.next_field = password_field

<purple>def</purple> submit():
    <blue>print</blue>(<green>'ursername:'</green>, username_field.text)
    <blue>print</blue>(<green>'password:'</green>,  password_field.text)

Button(<green>'Login'</green>, <olive>scale</olive>=.<yellow>1</yellow>, <olive>color</olive>=color.cyan.tint(-.<yellow>4</yellow>), <olive>y</olive>=-.<yellow>2</yellow><yellow>6</yellow>, <olive>on_click</olive>=submit).fit_to_text()
</div>
</div></div>
<div id="InputField"><div id="InputField" style="color:hsl(320.0, 89%, 28%); font-size:1.75em; font-weight:normal;">InputField<gray>(<a style="color: gray;" href="#Button">Button</a>)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/prefabs/input_field.py"><gray>ursina.prefabs.input_field</gray></a><br><br><params class="params">InputField(default_value='', label='', max_lines=1, max_width=24, **kwargs)</params>

default_value<gray> = default_value</gray> 
limit_content_to<gray> = None</gray> 
hide_content<gray> = False   # if set to True, will display content as '*'. can also be set to character instead of True.</gray> 
next_field<gray> = None</gray> 
text_field<gray> = TextField(world_parent=self, x=-.45, y=.3, z=-.1, max_lines=max_lines)</gray> 
active<gray> = False</gray> 
text
text_color

render()   
input(<gray>key</gray>)   

<div class="example">background = <olive>Entity</olive>(<olive>model</olive>=<green>'quad'</green>, <olive>texture</olive>=<green>'pixelscape_combo'</green>, <olive>parent</olive>=camera.ui, <olive>scale</olive>=(camera.aspect_ratio,<yellow>1</yellow>), <olive>color</olive>=color.white)
gradient = <olive>Entity</olive>(<olive>model</olive>=<green>'quad'</green>, <olive>texture</olive>=<green>'vertical_gradient'</green>, <olive>parent</olive>=camera.ui, <olive>scale</olive>=(camera.aspect_ratio,<yellow>1</yellow>), <olive>color</olive>=color.hsv(<yellow>2</yellow><yellow>4</yellow><yellow>0</yellow>,.<yellow>6</yellow>,.<yellow>1</yellow>,.<yellow>7</yellow><yellow>5</yellow>))

username_field = <purple><b>InputField</b></purple>(<olive>y</olive>=-.<yellow>1</yellow><yellow>2</yellow>)
password_field = <purple><b>InputField</b></purple>(<olive>y</olive>=-.<yellow>1</yellow><yellow>8</yellow>, hide_content=True)
username_field.next_field = password_field

<purple>def</purple> submit():
    <blue>print</blue>(<green>'ursername:'</green>, username_field.text)
    <blue>print</blue>(<green>'password:'</green>,  password_field.text)

Button(<green>'Login'</green>, <olive>scale</olive>=.<yellow>1</yellow>, <olive>color</olive>=color.cyan.tint(-.<yellow>4</yellow>), <olive>y</olive>=-.<yellow>2</yellow><yellow>6</yellow>, <olive>on_click</olive>=submit).fit_to_text()
</div>
</div></div>
<div id="MemoryCounter"><div id="MemoryCounter" style="color:hsl(320.0, 89%, 28%); font-size:1.75em; font-weight:normal;">MemoryCounter<gray>(<a style="color: gray;" href="#Text">Text</a>)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/prefabs/memory_counter.py"><gray>ursina.prefabs.memory_counter</gray></a><br><br><params class="params">MemoryCounter(**kwargs)</params>

parent<gray> = camera.ui</gray> 
position<gray> = window.bottom_right</gray> 
origin<gray> = (0.5, -0.5)</gray> 
process<gray> = psutil.Process(os.getpid())</gray> 
i<gray> = 0</gray> 
text<gray> = 'eofiwjeofiwejf'</gray> 

update()   

<div class="example"><purple><b>MemoryCounter</b></purple>()
<green><green>''</green>'
Displays the amount of memory used in the bottom right corner
<green>''</green>'</green>
e = <olive>Entity</olive>(<olive>model</olive>=<green>'quad'</green>)
e.texture = <green>'shore'</green>
</div>
</div></div>
<div id="Panel"><div id="Panel" style="color:hsl(320.0, 89%, 28%); font-size:1.75em; font-weight:normal;">Panel<gray>(<a style="color: gray;" href="#Entity">Entity</a>)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/prefabs/panel.py"><gray>ursina.prefabs.panel</gray></a><br><br><params class="params">Panel(**kwargs)</params>

parent<gray> = camera.ui</gray> 
model<gray> = Quad()</gray> 
color<gray> = Button.color</gray> 


<div class="example">p = <purple><b>Panel</b></purple>()
</div>
</div></div>
<div id="PlatformerController2d"><div id="PlatformerController2d" style="color:hsl(320.0, 89%, 28%); font-size:1.75em; font-weight:normal;">PlatformerController2d<gray>(<a style="color: gray;" href="#Entity">Entity</a>)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/prefabs/platformer_controller_2d.py"><gray>ursina.prefabs.platformer_controller_2d</gray></a><br><br><params class="params">PlatformerController2d(**kwargs)</params>

model<gray> = 'cube'</gray> 
origin_y<gray> = -.5</gray> 
scale_y<gray> = 2</gray> 
color<gray> = color.orange</gray> 
collider<gray> = 'box'</gray> 
animator<gray> = Animator({'idle' : None, 'walk' : None, 'jump' : None})</gray> 
walk_speed<gray> = 8</gray> 
walking<gray> = False</gray> 
velocity<gray> = 0 # the walk diection is stored here. -1 for left and 1 for right.</gray> 
jump_height<gray> = 4</gray> 
jump_duration<gray> = .5</gray> 
jumping<gray> = False</gray> 
max_jumps<gray> = 1</gray> 
jumps_left<gray> = self.max_jumps</gray> 
gravity<gray> = 1</gray> 
grounded<gray> = True</gray> 
air_time<gray> = 0   # this increase while we're falling and used when calculating the distance we fall so we fall faster and faster instead of linearly.</gray> 
traverse_target<gray> = scene     # by default, it wil collide with everything except itself. you can chage this to change the boxcast traverse target.</gray> 
gravity<gray> = 0</gray> 

update()   
input(<gray>key</gray>)   
jump()   
start_fall()   
land()   

<div class="example">camera.orthographic = True
camera.fov = <yellow>1</yellow><yellow>0</yellow>

ground = <olive>Entity</olive>(<olive>model</olive>=<green>'cube'</green>, <olive>color</olive>=color.white<yellow>3</yellow><yellow>3</yellow>, origin_<olive>y</olive>=.<yellow>5</yellow>, <olive>scale</olive>=(<yellow>2</yellow><yellow>0</yellow>, <yellow>1</yellow><yellow>0</yellow>, <yellow>1</yellow>), <olive>collider</olive>=<green>'box'</green>)
wall = <olive>Entity</olive>(<olive>model</olive>=<green>'cube'</green>, <olive>color</olive>=color.azure, <olive>origin</olive>=(-.<yellow>5</yellow>,.<yellow>5</yellow>), <olive>scale</olive>=(<yellow>5</yellow>,<yellow>1</yellow><yellow>0</yellow>), x=<yellow>1</yellow><yellow>0</yellow>, <olive>y</olive>=.<yellow>5</yellow>, <olive>collider</olive>=<green>'box'</green>)
wall_<yellow>2</yellow> = <olive>Entity</olive>(<olive>model</olive>=<green>'cube'</green>, <olive>color</olive>=color.white<yellow>3</yellow><yellow>3</yellow>, <olive>origin</olive>=(-.<yellow>5</yellow>,.<yellow>5</yellow>), <olive>scale</olive>=(<yellow>5</yellow>,<yellow>1</yellow><yellow>0</yellow>), x=<yellow>1</yellow><yellow>0</yellow>, <olive>y</olive>=<yellow>5</yellow>, <olive>collider</olive>=<green>'box'</green>)
ceiling = <olive>Entity</olive>(<olive>model</olive>=<green>'cube'</green>, <olive>color</olive>=color.white<yellow>3</yellow><yellow>3</yellow>, origin_<olive>y</olive>=-.<yellow>5</yellow>, <olive>scale</olive>=(<yellow>1</yellow>, <yellow>1</yellow>, <yellow>1</yellow>), <olive>y</olive>=<yellow>1</yellow>, <olive>collider</olive>=<green>'box'</green>)

<purple>def</purple> input(key):
    <purple>if</purple> key == <green>'c'</green>:
        wall.collision = <purple>not</purple> wall.collision
        <blue>print</blue>(wall.collision)


player_controller = PlatformerController<yellow>2</yellow>d(scale_<olive>y</olive>=<yellow>2</yellow>, jump_height=<yellow>4</yellow>, x=<yellow>3</yellow>)
camera.add_script(SmoothFollow(target=player_controller, offset=[<yellow>0</yellow>,<yellow>1</yellow>,-<yellow>3</yellow><yellow>0</yellow>], speed=<yellow>4</yellow>))

EditorCamera()
</div>
</div></div>
<div id="RadialMenu"><div id="RadialMenu" style="color:hsl(320.0, 89%, 28%); font-size:1.75em; font-weight:normal;">RadialMenu<gray>(<a style="color: gray;" href="#Entity">Entity</a>)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/prefabs/radial_menu.py"><gray>ursina.prefabs.radial_menu</gray></a><br><br><params class="params">RadialMenu(buttons=list(), **kwargs)</params>

parent<gray> = camera.ui</gray> 
buttons<gray> = buttons</gray> 
open_at_cursor<gray> = True</gray> 
open_duration<gray> = .25</gray> 
bg<gray> = Panel(
        parent=self,
        model='quad',
        z=99,
        scale=999,
        collider='box',
        color=color.color(0,0,0,.1),
        enabled=False)</gray> 
z<gray> = -99</gray> 
scale<gray> = .075</gray> 

on_enable()   
input(<gray>key</gray>)   

<div class="example">rm = <purple><b>RadialMenu</b></purple>(
    buttons = (
        RadialMenuButton(<olive>text</olive>=<green>'1'</green>),
        RadialMenuButton(<olive>text</olive>=<green>'2'</green>),
        RadialMenuButton(<olive>text</olive>=<green>'3'</green>),
        RadialMenuButton(<olive>text</olive>=<green>'4'</green>),
        RadialMenuButton(<olive>text</olive>=<green>'5'</green>, <olive>scale</olive>=.<yellow>5</yellow>),
        RadialMenuButton(<olive>text</olive>=<green>'6'</green>, <olive>color</olive>=color.red),
        ),
    enabled = False
    )
RadialMenuButton(<olive>text</olive>=<green>'6'</green>, <olive>color</olive>=color.red,x =-.<yellow>5</yellow>, <olive>scale</olive>=.<yellow>0</yellow><yellow>6</yellow>),
<purple>def</purple> enable_radial_menu():
    rm.enabled = True
cube = Button(<olive>parent</olive>=scene, <olive>model</olive>=<green>'cube'</green>, <olive>color</olive>=color.orange, <olive>highlight_color</olive>=color.azure, <olive>on_click</olive>=enable_radial_menu)
EditorCamera()
</div>
</div></div>
<div id="RadialMenuButton"><div id="RadialMenuButton" style="color:hsl(320.0, 89%, 28%); font-size:1.75em; font-weight:normal;">RadialMenuButton<gray>(<a style="color: gray;" href="#Button">Button</a>)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/prefabs/radial_menu.py"><gray>ursina.prefabs.radial_menu</gray></a><br><br><params class="params">RadialMenuButton(**kwargs)</params>



<div class="example">rm = RadialMenu(
    buttons = (
        <purple><b>RadialMenuButton</b></purple>(<olive>text</olive>=<green>'1'</green>),
        <purple><b>RadialMenuButton</b></purple>(<olive>text</olive>=<green>'2'</green>),
        <purple><b>RadialMenuButton</b></purple>(<olive>text</olive>=<green>'3'</green>),
        <purple><b>RadialMenuButton</b></purple>(<olive>text</olive>=<green>'4'</green>),
        <purple><b>RadialMenuButton</b></purple>(<olive>text</olive>=<green>'5'</green>, <olive>scale</olive>=.<yellow>5</yellow>),
        <purple><b>RadialMenuButton</b></purple>(<olive>text</olive>=<green>'6'</green>, <olive>color</olive>=color.red),
        ),
    enabled = False
    )
<purple><b>RadialMenuButton</b></purple>(<olive>text</olive>=<green>'6'</green>, <olive>color</olive>=color.red,x =-.<yellow>5</yellow>, <olive>scale</olive>=.<yellow>0</yellow><yellow>6</yellow>),
<purple>def</purple> enable_radial_menu():
    rm.enabled = True
cube = Button(<olive>parent</olive>=scene, <olive>model</olive>=<green>'cube'</green>, <olive>color</olive>=color.orange, <olive>highlight_color</olive>=color.azure, <olive>on_click</olive>=enable_radial_menu)
EditorCamera()
</div>
</div></div>
<div id="Sky"><div id="Sky" style="color:hsl(320.0, 89%, 28%); font-size:1.75em; font-weight:normal;">Sky<gray>(<a style="color: gray;" href="#Entity">Entity</a>)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/prefabs/sky.py"><gray>ursina.prefabs.sky</gray></a><br><br><params class="params">Sky(**kwargs)</params>


update()   

</div></div>
<div id="Slider"><div id="Slider" style="color:hsl(320.0, 89%, 28%); font-size:1.75em; font-weight:normal;">Slider<gray>(<a style="color: gray;" href="#Entity">Entity</a>)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/prefabs/slider.py"><gray>ursina.prefabs.slider</gray></a><br><br><params class="params">Slider(min=0, max=1, default=None, height=Text.size, text='', dynamic=False, **kwargs)</params>

parent<gray> = camera.ui</gray> 
vertical<gray> = False</gray> 
min<gray> = min</gray> 
max<gray> = max</gray> 
default<gray> = default</gray> 
step<gray> = 0</gray> 
height<gray> = height</gray> 
label<gray> = Text(parent=self, origin=(0.5, 0), x=-0.025, text=text)</gray> 
bg<gray> = Button(
        parent</gray> 
knob<gray> = Draggable(
        parent</gray> 
value<gray> = self.default</gray> 
dynamic<gray> = dynamic    # if set to True, will call on_value_changed() while dragging. if set to False, will only call on_value_changed() after dragging.</gray> 

bg_click()   
drop()   
update()   
slide()   

<div class="example">box = <olive>Entity</olive>(<olive>model</olive>=<green>'cube'</green>, origin_<olive>y</olive>=-.<yellow>5</yellow>, <olive>scale</olive>=<yellow>1</yellow>, <olive>color</olive>=color.orange)
slider = <purple><b>Slider</b></purple>(<yellow>0</yellow>, <yellow>2</yellow><yellow>0</yellow>, default=<yellow>1</yellow><yellow>0</yellow>, height=Text.size*<yellow>3</yellow>, <olive>y</olive>=-.<yellow>4</yellow>, step=<yellow>1</yellow>   )
slider = Thin<purple><b>Slider</b></purple>(x=-.<yellow>4</yellow>, <olive>y</olive>=-.<yellow>3</yellow><yellow>7</yellow>, <olive>text</olive>=<green>'contrast'</green>, dynamic=True)
slider.label.origin = (<yellow>0</yellow>,<yellow>0</yellow>)
slider.label.position = (.<yellow>2</yellow><yellow>5</yellow>, -.<yellow>1</yellow>)
<purple>def</purple> scale_box():
    box.scale_y = slider.value
slider.on_value_changed = scale_box
</div>
</div></div>
<div id="ThinSlider"><div id="ThinSlider" style="color:hsl(320.0, 89%, 28%); font-size:1.75em; font-weight:normal;">ThinSlider<gray>(Slider)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/prefabs/slider.py"><gray>ursina.prefabs.slider</gray></a><br><br><params class="params">ThinSlider(*args, **kwargs)</params>



<div class="example">box = <olive>Entity</olive>(<olive>model</olive>=<green>'cube'</green>, origin_<olive>y</olive>=-.<yellow>5</yellow>, <olive>scale</olive>=<yellow>1</yellow>, <olive>color</olive>=color.orange)
slider = Slider(<yellow>0</yellow>, <yellow>2</yellow><yellow>0</yellow>, default=<yellow>1</yellow><yellow>0</yellow>, height=Text.size*<yellow>3</yellow>, <olive>y</olive>=-.<yellow>4</yellow>, step=<yellow>1</yellow>   )
slider = <purple><b>ThinSlider</b></purple>(x=-.<yellow>4</yellow>, <olive>y</olive>=-.<yellow>3</yellow><yellow>7</yellow>, <olive>text</olive>=<green>'contrast'</green>, dynamic=True)
slider.label.origin = (<yellow>0</yellow>,<yellow>0</yellow>)
slider.label.position = (.<yellow>2</yellow><yellow>5</yellow>, -.<yellow>1</yellow>)
<purple>def</purple> scale_box():
    box.scale_y = slider.value
slider.on_value_changed = scale_box
</div>
</div></div>
<div id="Sprite"><div id="Sprite" style="color:hsl(320.0, 89%, 28%); font-size:1.75em; font-weight:normal;">Sprite<gray>(<a style="color: gray;" href="#Entity">Entity</a>)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/prefabs/sprite.py"><gray>ursina.prefabs.sprite</gray></a><br><br><params class="params">Sprite(texture=None, ppu=ppu, **kwargs)</params>

model<gray> = 'quad'</gray> 
texture<gray> = texture</gray> 
ppu<gray> = ppu</gray> 
aspect_ratio<gray> = self.texture.width / self.texture.height</gray> 
scale_x<gray> = self.scale_y * self.aspect_ratio</gray> 


<div class="example">camera.orthographic = True
camera.fov = <yellow>1</yellow>
Sprite.ppu = <yellow>1</yellow><yellow>6</yellow>
Texture.default_filtering = None
s = <purple><b>Sprite</b></purple>(<green>'brick'</green>, filtering=False)
</div>
</div></div>
<div id="TextField"><div id="TextField" style="color:hsl(320.0, 89%, 28%); font-size:1.75em; font-weight:normal;">TextField<gray>(<a style="color: gray;" href="#Entity">Entity</a>)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/prefabs/text_field.py"><gray>ursina.prefabs.text_field</gray></a><br><br><params class="params">TextField(**kwargs)</params>

font<gray> = 'VeraMono.ttf'</gray> 
line_height<gray> = 1</gray> 
max_lines<gray> = 99999</gray> 
text_entity<gray> = Text(
        parent</gray> 
line_numbers<gray> = Text(
        parent</gray> 
character_width<gray> = Text.get_width('a', font=self.font)</gray> 
cursor_parent<gray> = Entity(parent=self, scale=(self.character_width, -1*Text.size*self.line_height*1.16))</gray> 
cursor<gray> = Entity(parent=self.cursor_parent, model='cube', color=color.white33, origin=(-.5, -.5), scale=(.1, 1))</gray> 
bg<gray> = Entity(parent=self.cursor_parent, model='cube', color=color.dark_gray, origin=(-.5,-.5), z=1, scale=(120, 20), collider='box', visible=False)</gray> 
selection<gray> = None</gray> 
selection_parent<gray> = Entity(parent=self.cursor_parent)</gray> 
register_mouse_input<gray> = True</gray> 
text<gray> = ''</gray> 
replacements<gray> = dict()</gray> 
on_undo<gray> = list()</gray> 
on_redo<gray> = list()</gray> 
shifted_keys<gray> = {
        '-' : '_',
        '.' : ':',
        ',' : ';',
        '\'' : '*',
        '&lt' : '&gt',
        '+' : '?',
        '0' : '=',
        '1' : '!',
        '2' : '"',
        '3' : '#',
        # '4' : '¤',
        '5' : '%',
        '6' : '&',
        '7' : '/',
        '8' : '(',
        '9' : ')',</gray> 
alted_keys<gray> = {
        '\'' : '´',
        '0' : '}',
        '2' : '@',
        '3' : '£',
        '4' : '¤',
        '5' : '€',
        '7' : '{',
        '8' : '[',
        '9' : ']',</gray> 
shortcuts<gray> = {
        'newline':          ('enter', 'enter hold'),
        'erase':            ('backspace', 'backspace hold'),
        'erase_word':       ('ctrl+backspace', 'ctrl+backspace hold'),
        'delete_line':      ('ctrl+shift+k',),
        'undo':             ('ctrl+z', 'ctrl+z hold'),
        'redo':             ('ctrl+y', 'ctrl+y hold', 'ctrl+shift+z', 'ctrl+shift+z hold'),
        # 'save':             ('ctrl+s',),
        # 'save_as':          ('ctrl+shift+s',),
        'indent':           ('tab',),
        'dedent':           ('shift+tab',),
        'move_line_down':   ('ctrl+down arrow', 'ctrl+down arrow hold'),
        'move_line_up':     ('ctrl+up arrow', 'ctrl+up arrow hold'),
        # 'cut':              ('ctrl+x',),
        'copy':             ('ctrl+c',),
        'paste':            ('ctrl+v',),
        # 'select_all':       ('ctrl+a',),
        # 'toggle_comment':   ('ctrl+alt+c',),
        # 'find':             ('ctrl+f',),</gray> 

blink_cursor()   
add_text(<gray>s, move_cursor=True</gray>)   
move_line(<gray>a, b</gray>)   
erase()   
delete_selected()   
input(<gray>key</gray>)   
render()   
update()   
select_all()   
draw_selection()   

<div class="example">window.x = <yellow>2</yellow><yellow>0</yellow><yellow>0</yellow>

window.color = color.color(<yellow>0</yellow>, <yellow>0</yellow>, .<yellow>1</yellow>)
Button.color = color._<yellow>2</yellow><yellow>0</yellow>
window.color = color._<yellow>2</yellow><yellow>5</yellow>

Text.default_font = <green>'consola.ttf'</green>
Text.default_resolution = <yellow>1</yellow><yellow>6</yellow>*<yellow>2</yellow>
te = <purple><b>TextField</b></purple>(max_lines=<yellow>3</yellow><yellow>0</yellow><yellow>0</yellow>, <olive>scale</olive>=<yellow>1</yellow>)
te.text = dedent(<green><green>''</green>'
    Lorem ipsum dolor sit amet, consectetur adipiscing elit.
    Aliquam sapien tellus, venenatis sit amet ante et, malesuada porta risus.
    Etiam et mi luctus, viverra urna at, maximus eros. Sed dictum faucibus purus,
    nec rutrum ipsum condimentum in. Mauris iaculis arcu nec justo rutrum euismod.
    Suspendisse dolor tortor, congue id erat sit amet, sollicitudin facilisis velit.<green>''</green>'</green>
    )[<yellow>1</yellow>:]
te.render()
</div>
</div></div>
<div id="Tooltip"><div id="Tooltip" style="color:hsl(320.0, 89%, 28%); font-size:1.75em; font-weight:normal;">Tooltip<gray>(<a style="color: gray;" href="#Text">Text</a>)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/prefabs/tooltip.py"><gray>ursina.prefabs.tooltip</gray></a><br><br><params class="params">Tooltip(text='', **kwargs)</params>

original_scale<gray> = self.scale</gray> 

update()   

<div class="example">app = Ursina()

    tooltip_test = <purple><b>Tooltip</b></purple>(
    <green>'&ltscale:1.5&gt&ltpink&gt'</green> + <green>'Rainstorm'</green> + <green>'&ltscale:1&gt \n \n'</green> +
<green><green>''</green>'Summon a &ltblue&gtrain
storm &ltdefault&gtto deal 5 &ltblue&gtwater
damage &ltdefault&gtto &ltred&gteveryone, &ltdefault&gtincluding &ltorange&gtyourself. &ltdefault&gt
Lasts for 4 rounds.<green>''</green><green>'</green>.replace('</green>\n<green>', '</green> '))

    tooltip_test.enabled = True
    app.run()
</div>
</div></div>
<div id="TrailRenderer"><div id="TrailRenderer" style="color:hsl(320.0, 89%, 28%); font-size:1.75em; font-weight:normal;">TrailRenderer<gray>(<a style="color: gray;" href="#Entity">Entity</a>)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/prefabs/trail_renderer.py"><gray>ursina.prefabs.trail_renderer</gray></a><br><br><params class="params">TrailRenderer(target=None, **kwargs)</params>

model<gray> = Mesh(
        vertices=[Vec3(0,0,0) for i in range(6)],
        colors=[lerp(color.clear, color.white, i/6*2) for i in range(6)],
        mode='line',
        thickness=5,
        static=False</gray> 
target<gray> = target</gray> 
update_step<gray> = .025</gray> 

update()   

<div class="example">mouse.visible = False
player = <olive>Entity</olive>(<olive>model</olive>=<green>'cube'</green>, <olive>scale</olive>=.<yellow>1</yellow>, <olive>color</olive>=color.orange)
trail_renderer = <purple><b>TrailRenderer</b></purple>(target=player)

<purple>def</purple> update():
    player.position = mouse.position * <yellow>1</yellow><yellow>0</yellow>
</div>
</div></div>
<div id="VideoRecorder"><div id="VideoRecorder" style="color:hsl(320.0, 89%, 28%); font-size:1.75em; font-weight:normal;">VideoRecorder<gray>(<a style="color: gray;" href="#Entity">Entity</a>)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/prefabs/video_recorder.py"><gray>ursina.prefabs.video_recorder</gray></a><br><br><params class="params">VideoRecorder(duration=5, name='untitled_video', **kwargs)</params>

recording<gray> = False</gray> 
file_path<gray> = Path(application.asset_folder) / 'video_temp'</gray> 
i<gray> = 0</gray> 
duration<gray> = duration</gray> 
frame_skip<gray> = 2  # 30 fps</gray> 
video_name<gray> = name</gray> 

input(<gray>key</gray>)   
update()   
renderToPNM()   
convert_to_gif()   

<div class="example">cube = primitives.RedCube()
cube.animate_x(<yellow>5</yellow>, duration=<yellow>5</yellow>, <olive>curve</olive>=curve.linear)
cube.animate_x(<yellow>0</yellow>, duration=<yellow>5</yellow>, <olive>curve</olive>=curve.linear, dela<olive>y</olive>=<yellow>5</yellow>)
Cursor()
</div>
</div></div>
<div id="VideoRecorderUI"><div id="VideoRecorderUI" style="color:hsl(320.0, 89%, 28%); font-size:1.75em; font-weight:normal;">VideoRecorderUI<gray>(WindowPanel)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/prefabs/video_recorder.py"><gray>ursina.prefabs.video_recorder</gray></a><br><br><params class="params">VideoRecorderUI(**kwargs)</params>

duration_label<gray> = Text('duration:')</gray> 
duration_field<gray> = InputField(default_value='5')</gray> 
fps_label<gray> = Text('fps:')</gray> 
fps_field<gray> = InputField(default_value='30')</gray> 
name_label<gray> = Text('name:')</gray> 
name_field<gray> = InputField(default_value='untitled_video')</gray> 
start_button<gray> = Button(text='Start Recording [Shift+F12]', color=color.azure, on_click=self.start_recording)</gray> 
y<gray> = .5</gray> 
visible<gray> = False</gray> 

input(<gray>key</gray>)   
start_recording()   

<div class="example">cube = primitives.RedCube()
cube.animate_x(<yellow>5</yellow>, duration=<yellow>5</yellow>, <olive>curve</olive>=curve.linear)
cube.animate_x(<yellow>0</yellow>, duration=<yellow>5</yellow>, <olive>curve</olive>=curve.linear, dela<olive>y</olive>=<yellow>5</yellow>)
Cursor()
</div>
</div></div>
<div id="Space"><div id="Space" style="color:hsl(320.0, 89%, 28%); font-size:1.75em; font-weight:normal;">Space<gray>()</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/prefabs/window_panel.py"><gray>ursina.prefabs.window_panel</gray></a><br><br><params class="params">Space(height=1)</params>

height<gray> = height</gray> 


<div class="example"><green><green>''</green>'
WindowPanel is an easy way to create UI. It will automatically layout the content.
<green>''</green>'</green>
wp = WindowPanel(
    title=<green>'Custom Window'</green>,
    content=(
        Text(<green>'Name:'</green>),
        InputField(name=<green>'name_field'</green>),
        Button(<olive>text</olive>=<green>'Submit'</green>, <olive>color</olive>=color.azure),
        Slider(),
        Slider(),
        ),
        popup=True,
        <olive>enabled</olive>=False
    )

<purple>def</purple> input(key):
    <purple>if</purple> key == <green>'space'</green>:
        wp.enabled = True
</div>
</div></div>
<div id="WindowPanel"><div id="WindowPanel" style="color:hsl(320.0, 89%, 28%); font-size:1.75em; font-weight:normal;">WindowPanel<gray>(<a style="color: gray;" href="#Draggable">Draggable</a>)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/prefabs/window_panel.py"><gray>ursina.prefabs.window_panel</gray></a><br><br><params class="params">WindowPanel(title='', content=[], **kwargs)</params>

content<gray> = content</gray> 
text<gray> = title</gray> 
popup<gray> = False</gray> 
panel<gray> = Panel(parent=self, origin=(0, .5), z=.1, color=self.color.tint(.1))</gray> 

layout()   
on_enable()   
close()   

<div class="example"><green><green>''</green>'
WindowPanel is an easy way to create UI. It will automatically layout the content.
<green>''</green>'</green>
wp = <purple><b>WindowPanel</b></purple>(
    title=<green>'Custom Window'</green>,
    content=(
        Text(<green>'Name:'</green>),
        InputField(name=<green>'name_field'</green>),
        Button(<olive>text</olive>=<green>'Submit'</green>, <olive>color</olive>=color.azure),
        Slider(),
        Slider(),
        ),
        popup=True,
        <olive>enabled</olive>=False
    )

<purple>def</purple> input(key):
    <purple>if</purple> key == <green>'space'</green>:
        wp.enabled = True
</div>
</div></div>
<div id="chunk_mesh"><div id="chunk_mesh" style="color:hsl(290.0, 89%, 28%); font-size:1.75em; font-weight:normal;">chunk_mesh</div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/scripts/chunk_mesh.py"><gray>ursina.scripts.chunk_mesh</gray></a><br><br>app<gray> = Ursina()</gray> 
t<gray> = time.time()</gray> 
application.asset_folder<gray> = application.asset_folder.parent.parent</gray> 
terrain<gray> = Entity(model=Terrain('grass_fields_heightmap', skip=8), texture='grass', texture_scale=(3,3), scale=256)</gray> 
grid<gray> = [[None for z in range(8)] for x in range(8)] # make 2d array of entities</gray> 
x_slices<gray> = 8</gray> 
z_slices<gray> = 8</gray> 
terrain.model.generated_vertices<gray> = [v+Vec3(.5,0.5) for v in terrain.model.generated_vertices]</gray> 
player<gray> = FirstPersonController(position=(0,200,0))</gray> 
player.add_script(NoclipMode())
app.run()

update()   

</div></div>
<div id="colorize"><div id="colorize" style="color:hsl(290.0, 89%, 28%); font-size:1.75em; font-weight:normal;">colorize</div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/scripts/colorize.py"><gray>ursina.scripts.colorize</gray></a><br><br>
get_world_normals(<gray>model</gray>)   
colorize(<gray>model, left=color.white, right=color.blue, down=color.red, up=color.green, back=color.white, forward=color.white, smooth=True, world_space=True</gray>)   

<div class="example"><purple>import</purple> random
<purple>for</purple> i in <blue>range</blue>(<yellow>1</yellow><yellow>0</yellow>):
    e = <olive>Entity</olive>(<olive>model</olive>=<green>'sphere'</green>)
    e.position = (random.uniform(-<yellow>3</yellow>,<yellow>3</yellow>),random.uniform(-<yellow>3</yellow>,<yellow>3</yellow>),random.uniform(-<yellow>3</yellow>,<yellow>3</yellow>))
    e.rotation = (random.uniform(<yellow>0</yellow>,<yellow>3</yellow><yellow>6</yellow><yellow>0</yellow>),random.uniform(<yellow>0</yellow>,<yellow>3</yellow><yellow>6</yellow><yellow>0</yellow>),random.uniform(<yellow>0</yellow>,<yellow>3</yellow><yellow>6</yellow><yellow>0</yellow>))
    e.scale = random.uniform(<yellow>1</yellow>,<yellow>3</yellow>)
    e.model.colorize(smooth=False)



Sky(<olive>color</olive>=color.gray)
EditorCamera()
</div>
</div></div>
<div id="combine"><div id="combine" style="color:hsl(290.0, 89%, 28%); font-size:1.75em; font-weight:normal;">combine</div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/scripts/combine.py"><gray>ursina.scripts.combine</gray></a><br><br>
combine(<gray>entity, analyze=False, auto_destroy=True, ignore=[]</gray>)   
get_vertices(<gray>entity, relative_to=None</gray>)   

<div class="example">p = <olive>Entity</olive>()
e<yellow>1</yellow> = <olive>Entity</olive>(<olive>parent</olive>=p, <olive>model</olive>=<green>'sphere'</green>, <olive>y</olive>=<yellow>1</yellow>.<yellow>5</yellow>, <olive>color</olive>=color.pink)
e<yellow>2</yellow> = <olive>Entity</olive>(<olive>parent</olive>=p, <olive>model</olive>=<green>'cube'</green>, <olive>color</olive>=color.yellow, x=<yellow>1</yellow>, origin_<olive>y</olive>=-.<yellow>5</yellow>)
e<yellow>3</yellow> = <olive>Entity</olive>(<olive>parent</olive>=e<yellow>2</yellow>, <olive>model</olive>=<green>'cube'</green>, <olive>color</olive>=color.yellow, <olive>y</olive>=<yellow>2</yellow>, <olive>scale</olive>=.<yellow>5</yellow>)
p.combine()


EditorCamera()
</div>
</div></div>
<div id="generate_normals"><div id="generate_normals" style="color:hsl(290.0, 89%, 28%); font-size:1.75em; font-weight:normal;">generate_normals</div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/scripts/generate_normals.py"><gray>ursina.scripts.generate_normals</gray></a><br><br>
normalize_v3(<gray>arr</gray>)   
generate_normals(<gray>vertices, triangles=None, smooth=True</gray>)   

<div class="example">vertices = (
    (-<yellow>0</yellow>.<yellow>0</yellow>, -<yellow>0</yellow>.<yellow>5</yellow>, <yellow>0</yellow>.<yellow>0</yellow>), (<yellow>0</yellow>.<yellow>1</yellow>, -<yellow>0</yellow>.<yellow>4</yellow><yellow>8</yellow>, -<yellow>0</yellow>.<yellow>0</yellow><yellow>7</yellow><yellow>3</yellow>), (-<yellow>0</yellow>.<yellow>0</yellow><yellow>3</yellow><yellow>8</yellow>, -<yellow>0</yellow>.<yellow>4</yellow><yellow>8</yellow>, -<yellow>0</yellow>.<yellow>1</yellow><yellow>1</yellow>),
    (<yellow>0</yellow>.<yellow>3</yellow><yellow>6</yellow><yellow>1</yellow><yellow>8</yellow><yellow>0</yellow><yellow>4</yellow>, -<yellow>0</yellow>.<yellow>2</yellow><yellow>2</yellow>, -<yellow>0</yellow>.<yellow>2</yellow><yellow>6</yellow>), (<yellow>0</yellow>.<yellow>3</yellow>, -<yellow>0</yellow>.<yellow>3</yellow><yellow>2</yellow>, -<yellow>0</yellow>.<yellow>2</yellow><yellow>2</yellow>), (<yellow>0</yellow>.<yellow>4</yellow><yellow>0</yellow>, -<yellow>0</yellow>.<yellow>2</yellow><yellow>5</yellow>, -<yellow>0</yellow>.<yellow>1</yellow><yellow>4</yellow>),
    (-<yellow>0</yellow>.<yellow>0</yellow>, -<yellow>0</yellow>.<yellow>5</yellow>, <yellow>0</yellow>.<yellow>0</yellow>), (-<yellow>0</yellow>.<yellow>0</yellow><yellow>3</yellow><yellow>8</yellow>, -<yellow>0</yellow>.<yellow>4</yellow><yellow>8</yellow>, -<yellow>0</yellow>.<yellow>1</yellow><yellow>1</yellow>), (-<yellow>0</yellow>.<yellow>0</yellow><yellow>3</yellow>, -<yellow>0</yellow>.<yellow>4</yellow><yellow>8</yellow>, -<yellow>0</yellow>.<yellow>1</yellow><yellow>1</yellow>)
)
norms = generate_normals(vertices)
</div>
</div></div>
<div id="grid_layout"><div id="grid_layout" style="color:hsl(290.0, 89%, 28%); font-size:1.75em; font-weight:normal;">grid_layout</div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/scripts/grid_layout.py"><gray>ursina.scripts.grid_layout</gray></a><br><br>
grid_layout(<gray>l, max_x=8, max_y=8, spacing=(0,0,0), origin=(-.5,.5,0), offset=(0,0,0)</gray>)   

<div class="example">center = <olive>Entity</olive>(<olive>model</olive>=<green>'quad'</green>, <olive>scale</olive>=.<yellow>1</yellow>, <olive>color</olive>=color.red)
p = <olive>Entity</olive>()
<purple>for</purple> i in <blue>range</blue>(<yellow>4</yellow>*<yellow>5</yellow>):
    b = Button(<olive>parent</olive>=p, <olive>model</olive>=<green>'quad'</green>, <olive>scale</olive>=Vec2(.<yellow>2</yellow>,.<yellow>1</yellow>), <olive>text</olive>=str(i), <olive>color</olive>=color.tint(color.random_color(),-.<yellow>6</yellow>))
    b.text_entity.<olive>scale</olive>=<yellow>1</yellow>
t = time.time()
grid_layout(p.children, max_x=<yellow>7</yellow>, max_<olive>y</olive>=<yellow>1</yellow><yellow>0</yellow>, <olive>origin</olive>=(<yellow>0</yellow>, .<yellow>5</yellow>), spacing=(.<yellow>1</yellow><yellow>5</yellow>, <yellow>0</yellow>))
center = <olive>Entity</olive>(<olive>parent</olive>=camera.ui, <olive>model</olive>=Circle(), <olive>scale</olive>=.<yellow>0</yellow><yellow>0</yellow><yellow>5</yellow>, <olive>color</olive>=color.lime)
EditorCamera()
<blue>print</blue>(time.time() - t)
</div>
</div></div>
<div id="merge_vertices"><div id="merge_vertices" style="color:hsl(290.0, 89%, 28%); font-size:1.75em; font-weight:normal;">merge_vertices</div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/scripts/merge_vertices.py"><gray>ursina.scripts.merge_vertices</gray></a><br><br>
distance(<gray>a, b</gray>)   
merge_overlapping_vertices(<gray>vertices, triangles=None, max_distance=.1</gray>)   

<div class="example">verts = ((<yellow>0</yellow>,<yellow>0</yellow>,<yellow>0</yellow>), (<yellow>1</yellow>,<yellow>0</yellow>,<yellow>0</yellow>), (<yellow>1</yellow>,<yellow>1</yellow>,<yellow>0</yellow>), (<yellow>0</yellow>,<yellow>0</yellow>,<yellow>0</yellow>), (<yellow>1</yellow>,<yellow>1</yellow>,<yellow>0</yellow>), (<yellow>0</yellow>,<yellow>1</yellow>,<yellow>0</yellow>))
tris = (<yellow>0</yellow>,<yellow>1</yellow>,<yellow>2</yellow>,<yellow>3</yellow>,<yellow>4</yellow>,<yellow>5</yellow>)

new_verts, new_tris = merge_overlapping_vertices(verts, tris)
<blue>print</blue>(<green>'verts:'</green>, (verts), (new_verts))
<blue>print</blue>(<green>'tris:'</green>, (tris), (new_tris))


e = <olive>Entity</olive>(<olive>model</olive>=Mesh(new_verts, new_tris, <olive>mode</olive>=<green>'triangle'</green>))
EditorCamera()
</div>
</div></div>
<div id="NoclipMode"><div id="NoclipMode" style="color:hsl(290.0, 89%, 28%); font-size:1.75em; font-weight:normal;">NoclipMode</div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/scripts/noclip_mode.py"><gray>ursina.scripts.noclip_mode</gray></a><br><br><params class="params">NoclipMode(speed=10, require_key='shift')</params>

speed<gray> = speed</gray> 
require_key<gray> = require_key</gray> 
ignore_paused<gray> = True</gray> 

input(<gray>key</gray>)   
update()   

<div class="example">player = <olive>Entity</olive>(<olive>model</olive>=<green>'cube'</green>, <olive>color</olive>=color.orange)
<olive>Entity</olive>(<olive>model</olive>=<green>'plane'</green>, <olive>scale</olive>=<yellow>1</yellow><yellow>0</yellow>)
EditorCamera()


player.add_script(NoclipMode<yellow>2</yellow>d())
</div>
</div></div>
<div id="NoclipMode2d"><div id="NoclipMode2d" style="color:hsl(290.0, 89%, 28%); font-size:1.75em; font-weight:normal;">NoclipMode2d</div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/scripts/noclip_mode.py"><gray>ursina.scripts.noclip_mode</gray></a><br><br><params class="params">NoclipMode2d(speed=10, require_key='shift')</params>

speed<gray> = speed</gray> 
require_key<gray> = require_key</gray> 
ignore_paused<gray> = True</gray> 

input(<gray>key</gray>)   
update()   

<div class="example">player = <olive>Entity</olive>(<olive>model</olive>=<green>'cube'</green>, <olive>color</olive>=color.orange)
<olive>Entity</olive>(<olive>model</olive>=<green>'plane'</green>, <olive>scale</olive>=<yellow>1</yellow><yellow>0</yellow>)
EditorCamera()


player.add_script(NoclipMode<yellow>2</yellow>d())
</div>
</div></div>
<div id="PositionLimiter"><div id="PositionLimiter" style="color:hsl(290.0, 89%, 28%); font-size:1.75em; font-weight:normal;">PositionLimiter<gray>()</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/scripts/position_limiter.py"><gray>ursina.scripts.position_limiter</gray></a><br><br><params class="params">PositionLimiter(min_x=-math.inf, max_x=math.inf, min_y=-math.inf, max_y=math.inf, min_z=-math.inf, max_z=math.inf)</params>

min_x<gray> = min_x</gray> 
max_x<gray> = max_x</gray> 
min_y<gray> = min_y</gray> 
max_y<gray> = max_y</gray> 
min_z<gray> = min_z</gray> 
max_z<gray> = max_z</gray> 

update()   

</div></div>
<div id="project_uvs"><div id="project_uvs" style="color:hsl(290.0, 89%, 28%); font-size:1.75em; font-weight:normal;">project_uvs</div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/scripts/project_uvs.py"><gray>ursina.scripts.project_uvs</gray></a><br><br>
project_uvs(<gray>model, aspect_ratio=1, direction='forward', regenerate=False</gray>)   

<div class="example">e = <olive>Entity</olive>(<olive>model</olive>=<green>'sphere'</green>, <olive>texture</olive>=<green>'ursina_logo'</green>)
project_uvs(e.model)
EditorCamera()
</div>
</div></div>
<div id="Scrollable"><div id="Scrollable" style="color:hsl(290.0, 89%, 28%); font-size:1.75em; font-weight:normal;">Scrollable<gray>()</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/scripts/scrollable.py"><gray>ursina.scripts.scrollable</gray></a><br><br><params class="params">Scrollable(**kwargs)</params>

max<gray> = inf</gray> 
min<gray> = -inf</gray> 
scroll_speed<gray> = .05</gray> 
scroll_smoothing<gray> = 16</gray> 
axis<gray> = 'y'</gray> 
target_value<gray> = None</gray> 

update()   
input(<gray>key</gray>)   

<div class="example"><green><green>''</green>'
This will make target entity move up or down when you hover the entity/its children
while scrolling the scroll wheel.
<green>''</green>'</green>

zone = <olive>Entity</olive>(<olive>parent</olive>=camera.ui)
zone.set_scissor(Vec3(-.<yellow>5</yellow>,-.<yellow>2</yellow><yellow>5</yellow>,<yellow>0</yellow>), Vec3(.<yellow>5</yellow>,.<yellow>2</yellow><yellow>5</yellow>,<yellow>0</yellow>))

button_parent = Button(<olive>parent</olive>=zone, <olive>model</olive>=<green>'quad'</green>, <olive>scale</olive>=(.<yellow>4</yellow>, .<yellow>8</yellow>), <olive>collider</olive>=<green>'box'</green>, visible_self=False)

<purple>for</purple> i in <blue>range</blue>(<yellow>8</yellow>):
    Button(<olive>parent</olive>=button_parent , scale_<olive>y</olive>=.<yellow>0</yellow><yellow>5</yellow>, <olive>text</olive>=f<green>'giopwjoigjwr{i}'</green>, origin_<olive>y</olive>=.<yellow>5</yellow>, <olive>y</olive>=.<yellow>5</yellow>-(i*.<yellow>0</yellow><yellow>5</yellow><yellow>1</yellow>))

button_parent.add_script(<purple><b>Scrollable</b></purple>(min=-.<yellow>1</yellow><yellow>5</yellow>, max=.<yellow>1</yellow><yellow>2</yellow><yellow>5</yellow>))
</div>
</div></div>
<div id="SmoothFollow"><div id="SmoothFollow" style="color:hsl(290.0, 89%, 28%); font-size:1.75em; font-weight:normal;">SmoothFollow<gray>()</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/scripts/smooth_follow.py"><gray>ursina.scripts.smooth_follow</gray></a><br><br><params class="params">SmoothFollow(target=None, offset=(0,0,0), speed=8, rotation_speed=0, rotation_offset=(0,0,0))</params>

target<gray> = target</gray> 
offset<gray> = offset</gray> 
speed<gray> = speed</gray> 
rotation_speed<gray> = rotation_speed</gray> 
rotation_offset<gray> = rotation_offset</gray> 

update()   

<div class="example">player = <olive>Entity</olive>(<olive>model</olive>=<green>'cube'</green>, <olive>color</olive>=color.orange)

<purple>def</purple> update():
    player.x += held_keys[<green>'d'</green>] * .<yellow>1</yellow>
    player.x -= held_keys[<green>'a'</green>] * .<yellow>1</yellow>

<olive>Entity</olive>(<olive>model</olive>=<green>'cube'</green>).add_script(<purple><b>SmoothFollow</b></purple>(target=player, offset=(<yellow>0</yellow>,<yellow>2</yellow>,<yellow>0</yellow>)))
</div>
</div></div>
<div id="terraincast"><div id="terraincast" style="color:hsl(290.0, 89%, 28%); font-size:1.75em; font-weight:normal;">terraincast</div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/scripts/terraincast.py"><gray>ursina.scripts.terraincast</gray></a><br><br>
terraincast(<gray>origin, terrain): # mainly used for getting the y position on a terrain. returns a HitInfo like raycast(</gray>)   <gray># mainly used for getting the y position on a terrain. returns a HitInfo like raycast()</gray>

<div class="example">application.asset_folder = Path(<green>'.'</green>).parent.parent / <green>'samples'</green>
terrain = <olive>Entity</olive>(model = Terrain(<green>'heightmap_1'</green>, skip=<yellow>1</yellow><yellow>6</yellow>), <olive>scale</olive>=(<yellow>2</yellow><yellow>0</yellow>,<yellow>5</yellow>,<yellow>2</yellow><yellow>0</yellow>), <olive>rotation</olive>=(<yellow>0</yellow>,<yellow>4</yellow><yellow>5</yellow>,<yellow>0</yellow>), <olive>origin</olive>=( - <yellow>0</yellow>.<yellow>1</yellow>, - <yellow>0</yellow>.<yellow>1</yellow>, - <yellow>0</yellow>.<yellow>1</yellow>), <olive>texture</olive>=<green>'heightmap_1'</green>)
player = <olive>Entity</olive>(<olive>model</olive>=<green>'cube'</green>, origin_<olive>y</olive>= - <yellow>0</yellow>.<yellow>5</yellow>, <olive>scale</olive>=<yellow>0</yellow>.<yellow>1</yellow>, <olive>color</olive>=color.orange)

<purple>def</purple> update():
    player.x += (held_keys[<green>'d'</green>] - held_keys[<green>'a'</green>]) * time.dt * <yellow>5</yellow>
    player.z += (held_keys[<green>'w'</green>] - held_keys[<green>'s'</green>]) * time.dt * <yellow>5</yellow>

    hit_info = terraincast(player.world_position, terrain)
    <purple>if</purple> hit_info.hit:
        player.y = hit_info.world_point.y



EditorCamera()
Sky()
</div>
</div></div>
<div id="models"><div id="models" style="color:hsl(259.0, 89%, 28%); font-size:1.75em; font-weight:normal;">models</div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;">'circle'
'cube'
'cube_uv_top'
'diamond'
'icosphere'
'line'
'plane'
'quad'
'sky_dome'
'sphere'
'wireframe_cube'


<div class="example">e = Entity(model='quad')
</div>
</div></div>
<div id="textures"><div id="textures" style="color:hsl(259.0, 89%, 28%); font-size:1.75em; font-weight:normal;">textures</div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;">'arrow_down'
'arrow_right'
'brick'
'circle'
'circle_outlined'
'cursor'
'file_icon'
'folder'
'grass'
'heightmap_1'
'horizontal_gradient'
'noise'
'radial_gradient'
'reflection_map_3'
'shore'
'sky_default'
'sky_sunset'
'ursina_logo'
'ursina_wink_0000'
'ursina_wink_0001'
'vertical_gradient'
'white_cube'


<div class="example">e = Entity(model='cube', texture='brick')
</div>
</div></div>
<div id="shaders"><div id="shaders" style="color:hsl(259.0, 89%, 28%); font-size:1.75em; font-weight:normal;">shaders</div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;">basic_lighting_shader
colored_lights_shader
fading_shadows_shader
fresnel_shader
lit_with_shadows_shader
matcap_shader
normals_shader
texture_blend_shader
triplanar_shader
unlit_shader
__init__


<div class="example">from ursina.shaders import normals_shader
e = Entity(shader=normals_shader)
</div>
</div></div>
<div id="Circle"><div id="Circle" style="color:hsl(259.0, 89%, 28%); font-size:1.75em; font-weight:normal;">Circle<gray>(<a style="color: gray;" href="#Mesh">Mesh</a>)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/models/procedural/circle.py"><gray>ursina.models.procedural.circle</gray></a><br><br><params class="params">Circle(resolution=16, radius=.5, rotate=True, mode='ngon', **kwargs)</params>



<div class="example">e = <olive>Entity</olive>(<olive>model</olive>=<purple><b>Circle</b></purple>(<yellow>8</yellow>, <olive>mode</olive>=<green>'line'</green>, <olive>thickness</olive>=<yellow>1</yellow><yellow>0</yellow>), <olive>color</olive>=color.color(<yellow>6</yellow><yellow>0</yellow>,<yellow>1</yellow>,<yellow>1</yellow>,.<yellow>3</yellow>))
<blue>print</blue>(e.model.recipe)
origin = <olive>Entity</olive>(<olive>model</olive>=<green>'quad'</green>, <olive>color</olive>=color.orange, <olive>scale</olive>=(.<yellow>0</yellow><yellow>5</yellow>, .<yellow>0</yellow><yellow>5</yellow>))
ed = EditorCamera(rotation_speed = <yellow>2</yellow><yellow>0</yellow><yellow>0</yellow>, panning_speed=<yellow>2</yellow><yellow>0</yellow><yellow>0</yellow>)
</div>
</div></div>
<div id="Cone"><div id="Cone" style="color:hsl(259.0, 89%, 28%); font-size:1.75em; font-weight:normal;">Cone<gray>(<a style="color: gray;" href="#Mesh">Mesh</a>)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/models/procedural/cone.py"><gray>ursina.models.procedural.cone</gray></a><br><br><params class="params">Cone(resolution=4, radius=.5, height=1, direction=(0,1,0), add_bottom=True, mode='triangle', **kwargs)</params>



<div class="example"><olive>Entity</olive>(<olive>model</olive>=<purple><b>Cone</b></purple>(<yellow>8</yellow>, direction=(<yellow>0</yellow>,<yellow>1</yellow>,<yellow>0</yellow>)), <olive>color</olive>=color.color(<yellow>6</yellow><yellow>0</yellow>,<yellow>1</yellow>,<yellow>1</yellow>,.<yellow>3</yellow>))
origin = <olive>Entity</olive>(<olive>model</olive>=<green>'quad'</green>, <olive>color</olive>=color.orange, <olive>scale</olive>=(.<yellow>0</yellow><yellow>5</yellow>, .<yellow>0</yellow><yellow>5</yellow>))
ed = EditorCamera(rotation_speed = <yellow>2</yellow><yellow>0</yellow><yellow>0</yellow>, panning_speed=<yellow>2</yellow><yellow>0</yellow><yellow>0</yellow>)
</div>
</div></div>
<div id="Cylinder"><div id="Cylinder" style="color:hsl(259.0, 89%, 28%); font-size:1.75em; font-weight:normal;">Cylinder<gray>(<a style="color: gray;" href="#Prismatoid">Prismatoid</a>)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/models/procedural/cylinder.py"><gray>ursina.models.procedural.cylinder</gray></a><br><br><params class="params">Cylinder(resolution=8, radius=.5, start=0, height=1, direction=(0,1,0), mode='triangle', **kwargs)</params>



<div class="example"><olive>Entity</olive>(<olive>model</olive>=<purple><b>Cylinder</b></purple>(<yellow>6</yellow>, start=-.<yellow>5</yellow>), <olive>color</olive>=color.color(<yellow>6</yellow><yellow>0</yellow>,<yellow>1</yellow>,<yellow>1</yellow>,.<yellow>3</yellow>))
origin = <olive>Entity</olive>(<olive>model</olive>=<green>'quad'</green>, <olive>color</olive>=color.orange, <olive>scale</olive>=(<yellow>5</yellow>, .<yellow>0</yellow><yellow>5</yellow>))
ed = EditorCamera(rotation_speed = <yellow>2</yellow><yellow>0</yellow><yellow>0</yellow>, panning_speed=<yellow>2</yellow><yellow>0</yellow><yellow>0</yellow>)
</div>
</div></div>
<div id="Grid"><div id="Grid" style="color:hsl(259.0, 89%, 28%); font-size:1.75em; font-weight:normal;">Grid<gray>(<a style="color: gray;" href="#Mesh">Mesh</a>)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/models/procedural/grid.py"><gray>ursina.models.procedural.grid</gray></a><br><br><params class="params">Grid(width, height, mode='line', thickness=1, **kwargs)</params>

width<gray> = width</gray> 
height<gray> = height</gray> 


<div class="example"><olive>Entity</olive>(<olive>model</olive>=<purple><b>Grid</b></purple>(<yellow>2</yellow>, <yellow>6</yellow>))
</div>
</div></div>
<div id="Plane"><div id="Plane" style="color:hsl(259.0, 89%, 28%); font-size:1.75em; font-weight:normal;">Plane<gray>(<a style="color: gray;" href="#Mesh">Mesh</a>)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/models/procedural/plane.py"><gray>ursina.models.procedural.plane</gray></a><br><br><params class="params">Plane(subdivisions=(1,1), mode='triangle', **kwargs)</params>

vertices, self.triangles<gray> = list(), list()</gray> 
uvs<gray> = list()</gray> 


<div class="example">front =  <olive>Entity</olive>(<olive>model</olive>=<purple><b>Plane</b></purple>(subdivisions=(<yellow>3</yellow>,<yellow>6</yellow>)), <olive>texture</olive>=<green>'brick'</green>, <olive>rotation_x</olive>=-<yellow>9</yellow><yellow>0</yellow>)

_ed = EditorCamera()
<olive>Entity</olive>(<olive>model</olive>=<green>'cube'</green>, <olive>color</olive>=color.green, <olive>scale</olive>=.<yellow>0</yellow><yellow>5</yellow>)
</div>
</div></div>
<div id="Prismatoid"><div id="Prismatoid" style="color:hsl(259.0, 89%, 28%); font-size:1.75em; font-weight:normal;">Prismatoid<gray>(<a style="color: gray;" href="#Mesh">Mesh</a>)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/models/procedural/prismatoid.py"><gray>ursina.models.procedural.prismatoid</gray></a><br><br><params class="params">Prismatoid(base_shape=Quad, origin=(0,0), path=((0,0,0),(0,1,0)), thicknesses=((1,1),), look_at=True, mode='triangle', **kwargs)</params>

base_shape<gray> = base_shape</gray> 


<div class="example">path = (Vec3(<yellow>0</yellow>,<yellow>0</yellow>,<yellow>0</yellow>), Vec3(<yellow>0</yellow>,<yellow>1</yellow>,<yellow>0</yellow>), Vec3(<yellow>0</yellow>,<yellow>3</yellow>,<yellow>0</yellow>), Vec3(<yellow>0</yellow>,<yellow>4</yellow>,<yellow>0</yellow>), Vec3(<yellow>2</yellow>,<yellow>5</yellow>,<yellow>0</yellow>))
thicknesses = ((<yellow>1</yellow>,<yellow>1</yellow>), (.<yellow>5</yellow>,.<yellow>5</yellow>), (.<yellow>7</yellow><yellow>5</yellow>,.<yellow>7</yellow><yellow>5</yellow>), (.<yellow>5</yellow>,.<yellow>5</yellow>), (<yellow>1</yellow>,<yellow>1</yellow>))
e = <olive>Entity</olive>(<olive>model</olive>=<purple><b>Prismatoid</b></purple>(path=path, thicknesses=thicknesses))
e.model.colorize()

EditorCamera()
origin = <olive>Entity</olive>(<olive>model</olive>=<green>'cube'</green>, <olive>color</olive>=color.magenta)
origin.scale *= .<yellow>2</yellow><yellow>5</yellow>
</div>
</div></div>
<div id="Quad"><div id="Quad" style="color:hsl(259.0, 89%, 28%); font-size:1.75em; font-weight:normal;">Quad<gray>(<a style="color: gray;" href="#Mesh">Mesh</a>)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/models/procedural/quad.py"><gray>ursina.models.procedural.quad</gray></a><br><br><params class="params">Quad(radius=.1, segments=8, aspect=1, scale=(1,1), mode='ngon', **kwargs)</params>

vertices<gray> = [Vec3(0,0,0), Vec3(1,0,0), Vec3(1,1,0), Vec3(0,1,0)]</gray> 
radius<gray> = radius</gray> 
mode<gray> = mode</gray> 
uvs<gray> = list()</gray> 
vertices<gray> = [(v[0]-offset[0], v[1]-offset[1], v[2]-offset[2]) for v in self.vertices]</gray> 


<div class="example"><olive>Entity</olive>(<olive>model</olive>=<purple><b>Quad</b></purple>(<olive>scale</olive>=(<yellow>3</yellow>,<yellow>1</yellow>), <olive>thickness</olive>=<yellow>3</yellow>, segments=<yellow>3</yellow>, <olive>mode</olive>=<green>'line'</green>), color = color.color(<yellow>0</yellow>,<yellow>1</yellow>,<yellow>1</yellow>,.<yellow>7</yellow>))
<olive>Entity</olive>(<olive>scale</olive>=(<yellow>3</yellow>,<yellow>1</yellow>), <olive>model</olive>=<purple><b>Quad</b></purple>(aspect=<yellow>3</yellow>), color = color.color(<yellow>6</yellow><yellow>0</yellow>,<yellow>1</yellow>,<yellow>1</yellow>,.<yellow>3</yellow>))
origin = <olive>Entity</olive>(<olive>model</olive>=<green>'quad'</green>, <olive>color</olive>=color.orange, <olive>scale</olive>=(.<yellow>0</yellow><yellow>5</yellow>, .<yellow>0</yellow><yellow>5</yellow>))
camera.z = -<yellow>5</yellow>
</div>
</div></div>
<div id="Terrain"><div id="Terrain" style="color:hsl(259.0, 89%, 28%); font-size:1.75em; font-weight:normal;">Terrain<gray>(<a style="color: gray;" href="#Mesh">Mesh</a>)</gray></div><div style="position:relative; padding:0em 0em 2em 1em; margin:0;"><a href="https://github.com/pokepetter/ursina/tree/master/ursina/models/procedural/terrain.py"><gray>ursina.models.procedural.terrain</gray></a><br><br><params class="params">Terrain(heightmap, skip=1, **kwargs)</params>

heightmap<gray> = heightmap</gray> 
skip<gray> = skip    # should be power of two.</gray> 
width, self.depth<gray> = self.heightmap.width//skip, self.heightmap.height//skip</gray> 
aspect_ratio<gray> = self.width / self.depth</gray> 
height_values<gray> = asarray(img)</gray> 
height_values<gray> = flip(self.height_values, axis=0)</gray> 
height_values<gray> = swapaxes(self.height_values, 0, 1)</gray> 
vertices, self.triangles<gray> = list(), list()</gray> 
uvs<gray> = list()</gray> 
normals<gray> = list()</gray> 
height_values<gray> = [[j[0]/255 for j in i] for i in self.height_values]</gray> 


<div class="example">e = <olive>Entity</olive>(<olive>model</olive>=<purple><b>Terrain</b></purple>(<green>'heightmap_1'</green>, skip=<yellow>1</yellow><yellow>6</yellow>), <olive>scale</olive>=(<yellow>2</yellow><yellow>0</yellow>,<yellow>5</yellow>,<yellow>2</yellow><yellow>0</yellow>), <olive>texture</olive>=<green>'heightmap_1'</green>)
<olive>Entity</olive>(<olive>model</olive>=<green>'plane'</green>, <olive>scale</olive>=e.scale, <olive>color</olive>=color.red)
EditorCamera()
Sky()
</div>
</div></div></div></div></body>